Repository navigation
contain: close PR_SET_PDEATHSIG setup race - #299
Merged
Merged
Conversation
Collaborator
|
Thank you! |
zerox80
pushed a commit
to zerox80/nsjail
that referenced
this pull request
Oct 16, 2026
contain: close PR_SET_PDEATHSIG setup race
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
contain: close PR_SET_PDEATHSIG setup race
Summary
Install the jailed child's parent-death signal before containment setup begins, and verify that the supervisor is still alive after installing it.
Clone-based modes use the existing parent/child socket as the liveness check. This works when
CLONE_NEWPIDmakes the outside parent appear as PID 0 inside the child namespace.EXECVEmode retains a captured-parent-PID check because it has no supervisor socket.The signal is installed a second time after user-namespace credential setup because Linux clears
PR_SET_PDEATHSIGwhen effective UID or GID credentials change.Problem
The current signal is installed near the end of
containProc(), after user, PID, mount, network, UTS, cgroup, capability, CPU, TSC, and rlimit setup. Linux does not deliver the parent-death signal retroactively when the parent has already exited beforePR_SET_PDEATHSIGis called.A deterministic local probe stopped the child immediately before the existing call and terminated only the nsjail supervisor. On the unmodified tree, the child then executed the requested workload. With this change, the same condition is detected before containment setup proceeds and the workload is not executed.
Validation
makepasses with-Wall -Wextra -Werror.docker build . --file Dockerfilepasses from a cleanmake clean && makestage./bin/trueand expected-failure/bin/falsesmoke checks pass.EXECVEmode/bin/truepasses.LD_PRELOADdifferential probe reportsBASELINE_MARKER=PRESENTon the pinned parent andPATCHED_MARKER=ABSENTwith this commit.git diff --checkand clang-format 18 dry-run pass.make testpasses its first four basic/seccomp checks in Ubuntu 24.04 under WSL2, then reaches an environment-specific failure in the existingpasta-nattest because WSL rejects the read-only bind remount of/etc/resolv.confwithEINVAL. The same limitation is present on the unmodified baseline and is unrelated to this change.