[Bug libc/14578] fchmodat(..., AT_SYMLINK_NOFOLLOW) returns ENOTSUP on non-symlinks

bugdal at aerifal dot cx sourceware-bugzilla@sourceware.org
Fri Aug 2 16:21:00 GMT 2013


http://sourceware.org/bugzilla/show_bug.cgi?id=14578

--- Comment #10 from Rich Felker <bugdal at aerifal dot cx> ---
I have solved the issue: while various syscalls such as fchmod, and even fstat
on all but very-new kernels, fail on O_PATH file descriptors, the corresponding
non-f-prefixed calls work on /proc/self/fd/%d.

I will be using this approach in musl libc to fix the fchmodat issue in a
completely race-free way that works on all O_PATH kernels, and works modulo the
need for read permissions to open the file even on older kernels. I will also
be using it to fix fchmod, fstat, etc. on O_PATH file descriptors, so that
O_PATH becomes a conforming implementation of O_SEARCH and O_EXEC. I think
glibc could do the same.

(Note that glibc may want to include the test I mentioned in an earlier post on
this issue to make sure O_PATH is supported, in case unintended opening of
files with O_RDONLY is deemed dangerous, e.g. for devices.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list