Post #1887729
2026-04-24 09:49 UTC
@swick
I've long thought that there's a hole that needs filling, that does what the original #Unix namei does but allows application mode code to supply everything necessary as (opaque) open descriptors: the root directory, the working directory, and the security credentials.
Frustratingly, Unix openat(), Windows NT's NtCreateFile(), and #Hurd's dir_lookup() all come close but all miss a final piece of the puzzle in different ways. openat() misses, for example, a descriptor for the root directory and something like NT's process token handles for security processing. NT has odd ideas about current directories.
This way, server processes could simply make use of the kernel's own already existing logic to handle not traversing '..' over a changed root, following symbolic links, and checking security using client credentials.
There's so much reinvention of this wheel that would have been resolved decades ago if it had only been exposed as a system call.
#filesystems
Replies (2)
-
@bugaevc@floss.social 2026-04-24 10:16
@JdeBP @swick what's in your view wrong with dir_lookup?
-
@jamesh@aus.social 2026-04-24 14:02
@JdeBP @swick openat2() with the RESOLVE_IN_ROOT would seem to cover that? Or RESOLVE_BENEATH if you just want to make sure the opened file is below dirfd without changing the meaning of absolute symlinks.