Expand description
Process-level hardening against the /proc/<pid>/environ side channel.
build_shell_env (see shell.rs) sanitizes the environment array handed to each
spawned subprocess, but that only covers the array Command passes at execve
time. It does nothing about a bash child reading its own parent’s raw kernel-recorded
environment via /proc/$PPID/environ — a channel entirely outside Command’s
control. Marking the runtime process non-dumpable closes that channel: the kernel’s
ptrace_may_access check (which gates /proc/pid/environ reads) fails for a
non-dumpable target even when the reader shares the same UID.
Scope: this process, not its descendants. The flag is inherited across fork(), but the
forked shell-tool child deliberately undoes it for itself
(sandbox::linux_enforce::restore_child_dumpable, inside pre_exec, before the seccomp filter
is installed). It has to: the same ptrace_may_access check that closes this side channel also
blocks the seccomp-notify supervisor thread — which lives in this process — from reading the
child’s /proc/<pid>/mem to recover the pathname of a notified execve, so every allowlisted
execve was denied for a non-root user until the child re-enabled its own flag. The
asymmetry is the point: this process may hold raw, unfiltered secrets in its environment, while
the child’s environment is already reduced to shell::DEFAULT_ENV_BASELINE plus explicit
overrides by shell::build_shell_env before it is spawned. The resulting exposure, and the
hand-run check for it, are in
docs/content/reference/workdir-device-node-manual-verification.md.
Functions§
- harden_
process_ dumpable - Marks the current process non-dumpable so no same-UID process — including its own
shell descendants — can read this process’s
/proc/<pid>/environ.