On Fri Feb 16 16:25:12 2024 +0000, Gabriel Ivăncescu wrote:
Sorry, I was talking about the race condition and using readlink on the actual file in my example (which accesses the filesystem), if used unconditionally.
There are two levels of indirection in a symlink pathname that can be concurrently modified: the poointer (symlink filename itself) and the pointee (resolution of the link target).
- Pointer pathname: yes, this is a general problem if readlink() argument was arbitrary. `/proc/self/fd/<N>` on the other hand should be stable, since `/proc/self` refers to the current process (wineserver) which is single-threaded. - Pointee pathname: also yes, and this is a problem for `/proc/self/fd/<N>` too. `/path/to/pointee`, which was returned by readlink, might get deleted or replaced with an entirely different file, rendering `/proc/self/fd/<N>`'s link-target stale. Again, not a problem, since this is completely expected (we don't rely on `unix_name` to be up to date already.)