Skip to main content

harden_process_dumpable

Function harden_process_dumpable 

Source
pub fn harden_process_dumpable() -> Result<(), String>
Expand description

Marks the current process non-dumpable so no same-UID process — including its own shell descendants — can read this process’s /proc/<pid>/environ.

Must be called as the first statement of main() in every binary that links this crate and can reach execute_shell, before any argument parsing or subprocess-capable code runs. A future binary that links capsule-runtime and reaches execute_shell inherits the same obligation.

Covers this process for its entire life and nothing else. The spawned shell-tool child re-enables its own flag from pre_exec — see this module’s header for why that is required and what it trades away.

No-op on non-Linux targets: /proc/<pid>/environ and prctl(2) don’t exist there, so there is no side channel to close.