Re: [RFC v1] man/man2/close.2: CAVEATS: Document divergence from POSIX.1-2024
From: Rich Felker <dalias@libc.org>
Date: 2026-01-24 21:39:41
Also in:
linux-fsdevel
From: Rich Felker <dalias@libc.org>
Date: 2026-01-24 21:39:41
Also in:
linux-fsdevel
On Sat, Jan 24, 2026 at 08:34:01PM +0100, The 8472 wrote:
On 23/01/2026 01:33, Zack Weinberg wrote: [...]quoted
ERRORS EBADF The fd argument was not a valid, open file descriptor.Unfortunately EBADF from FUSE is passed through unfiltered by the kernel on close[0], that makes it more difficult to reliably detect bugs relating to double-closes of file descriptors.
Wow, that's a nasty bug. Are the kernel folks not amenable to fixing it? I wonder if that could even have security implications. I think you could detect these fraudulent EBADFs (albeit not under conditions where there's a race bug) by performing fcntl/F_GETFD before close and knowing the EBADF from close is fake is fcntl didn't EBADF, but that seems like an unreasonable cost to work around FUSE behaving badly. Rich