On Fri, Sep 4, 2026 at 10:53 PM Florian Weimer <[email protected]> wrote: > > * Chen Linxuan via: > > > This series adds PIDFD_GET_EXE, PIDFD_GET_CWD, and PIDFD_GET_ROOT. Each > > ioctl takes no argument and returns a close-on-exec O_PATH file > > descriptor referencing the corresponding task path. The new ioctls use > > the same ptrace permission check and nonzero-argument rejection as the > > existing pidfd namespace ioctls. > > How would one upgrade the O_PATH descriptor to a full descriptor without > a mounted /proc?
For PIDFD_GET_CWD and PIDFD_GET_ROOT, the returned O_PATH descriptor is typically used directly as a base directory for openat(2) or passed to fchdir(2), so upgrading it to a full descriptor is usually unnecessary. For cases where upgrading an O_PATH descriptor to a full descriptor is required without /proc mounted (such as inspecting the executable binary from PIDFD_GET_EXE), users can use the newly added O_EMPTYPATH flag with openat2(2) (introduced in Linux 7.2) to reopen the O_PATH descriptor. > > Thanks, > Florian > >
