Path resolution
Path resolution interprets a pathname's components to select the filesystem object or creation location addressed by an operation.
On Linux, absolute paths normally start at the process root; relative paths start at the working directory or an *at() directory descriptor. Intermediate components require search permission; final-component handling depends on the operation. [1]
O_NOFOLLOW affects only the final component. O_PATH | O_NOFOLLOW can obtain a descriptor for that link itself. [2]
openat2() RESOLVE_NO_SYMLINKS prevents symlink traversal throughout the path and implies RESOLVE_NO_MAGICLINKS, but does not confine lookup. RESOLVE_NO_XDEV separately blocks mount crossings, including bind mounts. [3]
RESOLVE_BENEATH rejects escapes from dirfd, including absolute paths and absolute symlink targets; it does not ban every relative symlink or '..'. RESOLVE_IN_ROOT instead roots absolute paths and absolute symlink targets at dirfd and keeps '..' there at that root. Linux v6.12 rejects combining these policies with EINVAL. [3] [4]
With either rooted policy, EAGAIN can mean a race prevented proving confinement. RESOLVE_CACHED can also return EAGAIN when lookup needs revalidation or I/O. A cache fallback may drop only RESOLVE_CACHED, retaining containment and link restrictions. Retry within a bounded budget or report failure, not through an unconstrained open. These rules govern that open, not a later rename. [3] [5]
RESOLVE_CACHED also rejects otherwise valid O_CREAT, O_TRUNC and O_TMPFILE requests before lookup in Linux v6.12. EAGAIN therefore does not uniquely identify an uncached name. [4]
Relations
- related
- Symbolic link, Inode, Hard link, Open file description, Atomic rename, O_PATH, Dentry, RESOLVE_CACHED, Directory, Directory search permission
Limitations
- Resolving a name does not freeze its contents or provide a snapshot of later namespace changes.
Citations
- Linux man-pages: path_resolution(7), lookup start and component handling
- Linux man-pages: open(2), O_NOFOLLOW and O_PATH
- Linux man-pages: openat2(2), resolve flags and their scope
- Linux v6.12: build_open_flags and mutually exclusive rooted lookup policies
- Linux v6.12 pathname lookup: rename_lock and scoped lookup races
Sources & caveats
- API review scoped to Linux; path-resolution flags are separate from persistence, application authorization and multi-operation concurrency protocols.
- Rooted lookup and retry guidance combines the Linux API contract with v6.12 implementation review; bounded retries are an application policy, not a kernel retry limit.