You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
user-forgeable __RUBASH_BACKGROUND_WRAPPER env var imposes PDEATHSIG semantics on every spawned child #866
child_pre_exec_reset() (src/builtins/kill.rs, gate at ~line 1965 at e6a54457bedb) enables prctl(PR_SET_PDEATHSIG, SIGKILL) for every spawned child whenever std::env::var("__RUBASH_BACKGROUND_WRAPPER") == "1". That variable is a plain, user-guessable name inserted verbatim by the background-wrapper spawn path (src/executor/compound_exec.rs ~line 520).
Consequence: any script that runs export __RUBASH_BACKGROUND_WRAPPER=1 makes every process the shell subsequently spawns — including ordinary third-party programs that never went through the wrapper spawn path — adopt the background-wrapper pdeathsig semantics (killed when their parent dies, plus the orphan self-check). Third-party process behavior is altered by an ambient variable the shell never sanctioned. Same class as #735: a user-spellable name colliding with a reserved space.
With the forged value the inner sleep (not spawned through the wrapper path) still gets PR_SET_PDEATHSIG.
Fix options, in preference order:
Before respawning the wrapper, env_remove the name from the inherited user env, then insert our own value — forged values then cannot be inherited, only constructed by our own spawn sites. Must verify no overlay path re-merges the parent env afterwards.
Namespace the name (__RUBASH_BGW_<pid>_<nonce>) and pass the nonce via the wrapper argv, so guessing the name is not enough.
Move the flag out of the environment entirely (spawn args / handle table).
Acceptance: a probe exercising the forged-env corner, pinning current-or-fixed behavior with a scripts/regression-catalog case id; no behavior change for clean environments.
Activity
Merge pull request #873 from unixwin/fix/866-867
fix(executor,builtins): #873 the wrapper respawn carries the handshak…