Post #3971120
2026-07-20 22:16 UTC
@madcoder@infosec.exchange On Linux, file descriptors directly refer to file objects, without the fileproc indirection that XNU has from what I remember; so ensuring that a reference is held on the file object is enough for almost everything to work fine.
(There are just some small weird corners of the kernel where that causes complications, in particular one of the flavors of advisory file locks, where file locks are normally cleared when file descriptor table entries are removed but you can end up with file locks being created after no more file descriptor table entries for the file exist...)
Replies (1)
-
@madcoder@infosec.exchange 2026-07-20 22:52
@jann@infosec.exchange right I get it, and the complexity added in XNU so that when you close a file it breaks a blocking read() with an EBADF error is somewhat annoying to maintain. but I think that from a synchronization and/or file descriptor management bugs (such as double-close etc...) it's a much nicer behavior. but oh well, I don't disagree that it's about papering over userspace being silly though.