diff options
author | Mark Johnston <markj@FreeBSD.org> | 2025-03-31 01:23:30 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2025-03-31 09:01:09 +0000 |
commit | 197997a4c36d8be5807688a4f973ebe8ae807a6e (patch) | |
tree | 10fb50ff025a1f21bd4770f15a5b2ae79a5ccd19 /share/doc/usd/22.trofftut/tt.mac | |
parent | 12ecb0fe0afda8c051605045e446371ddd34741f (diff) |
file: Fix offset handling in kern_copy_file_range()
One can ask copy_file_range(2) to use the file offsets of the file
descriptions that it copies from and to. We were updating those offsets
without any locking, which is incorrect and can lead to unkillable loops
in the event of a race (e.g., the check for overlapping ranges in
kern_copy_file_range() is subject to a TOCTOU race with the following
loop which range-locks the input and output file).
Use foffset_lock() to serialize updates to the file descriptions, as we
do for other, similar system calls.
Reported by: syzkaller
Reviewed by: rmacklem, kib
MFC after: 2 weeks
Fixes: bbbbeca3e9a3 ("Add kernel support for a Linux compatible copy_file_range(2) syscall.")
Differential Revision: https://reviews.freebsd.org/D49440
Diffstat (limited to 'share/doc/usd/22.trofftut/tt.mac')
0 files changed, 0 insertions, 0 deletions