Skip to content

mnt: mount the auto-provisioned /proc nosuid,nodev,noexec - #283

Open
h1-mrz wants to merge 1 commit into
google:masterfrom
h1-mrz:harden-proc-mount-flags
Open

mnt: mount the auto-provisioned /proc nosuid,nodev,noexec#283
h1-mrz wants to merge 1 commit into
google:masterfrom
h1-mrz:harden-proc-mount-flags

Conversation

@h1-mrz

@h1-mrz h1-mrz commented Jul 18, 2026

Copy link
Copy Markdown

The procfs nsjail auto-mounts (setupMounts) was created without nosuid/nodev/noexec, so it was mounted dev,suid,exec. Every other container runtime (runc, Docker, systemd-nspawn) mounts /proc nosuid,nodev,noexec: there is no legitimate reason for /proc to honor setuid bits, expose device nodes, or allow execution, and doing so needlessly widens the in-jail attack surface (e.g. a setuid-root binary or a device node reachable via a procfs path).

Both mount backends already honor these MountPt fields (mnt_newapi.cc, mnt_legacy.cc), and the flags remain operator-overridable via an explicit mount {} config entry.

Verified: /proc inside the jail now shows nosuid,nodev,noexec in /proc/self/mountinfo (was rw,relatime).

The procfs nsjail auto-mounts (setupMounts) was created without
nosuid/nodev/noexec, so it was mounted dev,suid,exec. Every other
container runtime (runc, Docker, systemd-nspawn) mounts /proc
nosuid,nodev,noexec: there is no legitimate reason for /proc to honor
setuid bits, expose device nodes, or allow execution, and doing so
needlessly widens the in-jail attack surface (e.g. a setuid-root binary
or a device node reachable via a procfs path).

Both mount backends already honor these MountPt fields (mnt_newapi.cc,
mnt_legacy.cc), and the flags remain operator-overridable via an explicit
mount {} config entry.

Verified: /proc inside the jail now shows nosuid,nodev,noexec in
/proc/self/mountinfo (was rw,relatime).
@h1-mrz

h1-mrz commented Aug 8, 2026

Copy link
Copy Markdown
Author

Friendly ping on this one :) — it's a small, self-contained hardening change (mounts the auto-provisioned /proc with nosuid,nodev,noexec), and CI is green (CLA + check-changes pass). Happy to rebase onto current master or adjust anything if that would help it land. Thanks for maintaining nsjail!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant