Skip to main content

do_open_path

Function do_open_path 

Source
pub fn do_open_path(
    r: &Req<'_>,
    dirfd: i32,
    path: &[u8],
    path_addr: u64,
    flags: i64,
) -> Result<Outcome, i32>
Expand description

An O_PATH open without ptrace.

Such descriptors cannot be injected, so directories and readable files are opened read-only instead, which serves the same purposes (openat relative to it, fstat, /proc/self/fd/N), through the pinned parent. O_DIRECTORY on anything but a directory is refused with ENOTDIR first, as the kernel does: mv probes its destination that way and takes a descriptor for a directory to move into. Anything else, a socket, a device, an unreadable file or a symlink opened with O_NOFOLLOW, goes through a transient alias so the kernel opens it in the tracee, which walks the host path itself.

ยงArguments

  • r - The notification.
  • dirfd - Base of a relative path.
  • path - Path as the tracee passed it.
  • path_addr - Where that string lives in the tracee.
  • flags - Host-form open flags, O_PATH included.