fd_freefile is maintained to fulfill the POSIX guarantee that the lowest
possible file descriptor is allocated on open. If we skip copying an
fd, it is a possible candidate for the lowest index.
First, the file descriptor installed with a kqueue created
without KQUEUE_CPONFORK missed this handling [*].
Second, fd_freefile should be updated only when the current fd index is
below it. A skipped fd above fd_freefile could raise it past a free slot.
PR: 300234 [*]
Reported by: Andrea Venturoli <freebsd@netfence.it>
Fixes: 1265516c5c61 ("struct file: add DFLAG_FORK, indicate copying on fork")
Fixes: 809f3121be66 ("fd: assign fd_freefile early when copying")Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable