Fix fcntl(F_DUPFD) to make it comply with min_fd#740
Conversation
aa3a2e8 to
6dfae55
Compare
fcntl(F_DUPFD) to make it comply with min_fd
| } | ||
| DupFdRequest::LowestAvailable => Ok(rds.fd_into_raw_integer(fd)), | ||
| DupFdRequest::LowestAtOrAbove(min_fd) => { | ||
| Ok(rds.fd_into_raw_integer_at_or_above(fd, min_fd)) |
There was a problem hiding this comment.
Weidong has a similar fix but do not require adding a new interface to the LiteBox:
litebox/litebox_shim_linux/src/syscalls/file.rs
Lines 4362 to 4369 in b0bca9f
There was a problem hiding this comment.
I did have a similar fix but there is a potential TOCTOU race.
There was a problem hiding this comment.
why is that? rds is locked at the top.
There was a problem hiding this comment.
Found that my old one and Weidong's one are similar but different. Revised this PR.
Draft for now because this PR is not urgent.
|
🤖 SemverChecks 🤖 No breaking API changes detected Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered. |
This PR fixes a bug of the current
fcntl(F_DUPFD)implementation.fcntl(F_DUPFD)should return anfdgreater than or equal to thearg(min_fd) but it doesn't.