Page MenuHomeFreeBSD

ktrace: fix a race between writes and close
ClosedPublic

Authored by kib on May 22 2021, 1:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 8 2024, 3:13 AM
Unknown Object (File)
Dec 22 2023, 4:13 PM
Unknown Object (File)
Dec 20 2023, 3:13 AM
Unknown Object (File)
Dec 2 2023, 1:46 PM
Unknown Object (File)
Nov 27 2023, 9:47 AM
Unknown Object (File)
Nov 22 2023, 8:07 AM
Unknown Object (File)
Nov 21 2023, 10:06 PM
Unknown Object (File)
Nov 21 2023, 6:13 PM
Subscribers
None

Details

Summary

It was possible that termination of ktrace session occured during some record write, in which case write occured after the close of the vnode. Use ktr_io_params refcounting to avoid this situation, by taking the reference on the structure instead of vnode.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.May 22 2021, 1:40 PM
kib created this revision.
markj added inline comments.
sys/kern/kern_ktrace.c
1357

So we disable tracing if the file is closed and re-opened, i.e., ABA-like race. I think that is ok.

This revision is now accepted and ready to land.May 22 2021, 3:56 PM
kib marked an inline comment as done.May 22 2021, 7:34 PM
kib added inline comments.
sys/kern/kern_ktrace.c
1357

Yes it is same as before ktr_io_params introduction, and I decided to keep it that way from that time.

This revision was automatically updated to reflect the committed changes.
kib marked an inline comment as done.