Repository navigation
Support running with no_new_privs - #656
Open
ricardobranco777 wants to merge 2 commits into
Open
ricardobranco777 wants to merge 2 commits into
ricardobranco777 wants to merge 2 commits into
Conversation
Author
|
Steps to test on openSUSE Tumbleweed 20261018:
|
There was a problem hiding this comment.
🟡 Changes recommended
Unconditional ambient-capability operations prevent startup on kernels without that support, bypassing the retained fallback.
1 open issue
What changed in this PR
This PR addresses the startup hang under no_new_privs described in #551 by preserving the child’s capabilities across execution.
Changes:
- Pass ambient capabilities to the child while retaining the re-execution fallback.
- Perform the parent-child handshake once and clear inheritable and ambient capabilities before starting the workload.
- Add regression coverage for both PID namespace modes and run it in CI.
| File | Description |
|---|---|
pkg/parent/parent.go |
Populate the child’s ambient capabilities from kernel-supported capabilities. |
pkg/child/child.go |
Update handshake and re-execution handling; clear inherited capabilities. |
hack/integration-no-new-privs.sh |
Test startup under no_new_privs with and without a PID namespace. |
.github/workflows/main.yaml |
Run the new integration test in CI. |
Review effort: Balanced
AkihiroSuda
reviewed
Oct 23, 2026
AkihiroSuda
reviewed
Oct 23, 2026
The child was started with CLONE_NEWUSER before its uid_map was written, so the exec dropped all the caps, and the child re-executed itself after the maps were written to gain them. With no_new_privs set, the re-exec cannot gain caps, so the child ended up waiting forever for a message from the parent. Start the child with all the caps as ambient caps, so it keeps them across the exec and does not need to re-execute. The re-execution is kept as a fallback for kernels without ambient caps (older than 4.3). The child now always does the handshake with the parent once, and clears the inheritable and ambient caps afterwards so they are not inherited by the workload. Fixes rootless-containers#551 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Ricardo Branco <rbranco@suse.de>
Run rootlesskit under `setpriv --no-new-privs` with unprivileged newuidmap/newgidmap stand-ins (the real ones are setuid or have file caps, which no_new_privs disables), and check that the child gets the caps and that no ambient caps leak into the workload. Without the fix for rootless-containers#551, rootlesskit hangs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Ricardo Branco <rbranco@suse.de>
ricardobranco777
force-pushed
the
fix-no-new-privs
branch
from
October 23, 2026 15:51
4e66003 to
de7d793
Compare
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.

The child was started with CLONE_NEWUSER before its uid_map was written, so the exec dropped all the caps, and the child re-executed itself after the maps were written to gain them. With no_new_privs set, the re-exec cannot gain caps, so the child ended up waiting forever for a message from the parent.
Start the child with all the caps as ambient caps, so it keeps them across the exec and does not need to re-execute. The re-execution is kept as a fallback. The child now always does the handshake with the parent once, and clears the inheritable and ambient caps afterwards so they are not inherited by the workload.
Fixes #551