Repository navigation
fix(supervisor): tolerate non-empty bounding set when CAP_SETPCAP is unavailable - #2072
Closed
waynesun09 wants to merge 2 commits into
Closed
waynesun09 wants to merge 2 commits into
waynesun09 wants to merge 2 commits into
Conversation
…unavailable On rootless Podman with AppArmor unprivileged user namespace restrictions (Ubuntu 24.04 default), CAP_SETPCAP is granted by Podman but blocked at the kernel level by AppArmor. This causes drop_capability_bounding_set() to fail with EPERM while the bounding set is non-empty — a case that was unhandled, crashing sandbox creation. Add a match arm that logs a warning and continues when EPERM is returned with a non-empty bounding set. The child process is still confined by seccomp and Landlock. Fixes: NVIDIA#2069 Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Run supervisor capability unit tests on a bare GHA ubuntu-24.04 runner as an unprivileged user, where CAP_SETPCAP is unavailable and the bounding set is non-empty. This exercises the EPERM + non-empty path that caused the NVIDIA#2069 crash. Also simplify drop_privileges_succeeds_for_current_group to expect success unconditionally now that the EPERM + non-empty case is tolerated. Refs: NVIDIA#2069 Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
|
Thank you for your interest in contributing to OpenShell, @waynesun09. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
3 tasks done
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.
Summary
Fixes #2069
On rootless Podman (and other user-namespace environments), Ubuntu 24.04's
apparmor_restrict_unprivileged_userns=1policy blocksprctl(PR_CAPBSET_DROP)even when
CAP_SETPCAPis nominally granted. This causesdrop_capability_bounding_set()to fail with
EPERMwhen the bounding set is non-empty, crashing the supervisorduring sandbox creation.
validate_capability_bounding_set_clear()forEPERMwith a non-empty bounding set — logs a warning and continues,relying on seccomp and Landlock for confinement
rootless-capsCI job inbranch-checks.ymlthat runs thesupervisor capability tests as an unprivileged user on a bare
ubuntu-24.04runner (AppArmor enforcing, noCAP_SETPCAP)Related: #2068
Changes
crates/openshell-supervisor-process/src/process.rsEPERM + empty bounding setand thecatch-all
Err(err)arms: whenEPERMis returned and the bounding setis non-empty, emit a
warn!()and returnOk(())capability_bounding_set_clear_rejects_nonempty_eperm→capability_bounding_set_clear_tolerates_nonempty_eperm, now assertsis_ok()drop_privileges_succeeds_for_current_group— unconditionallyasserts success regardless of
CAP_SETPCAPavailability.github/workflows/branch-checks.ymlrootless-capsjob: creates an unprivilegedtestuser, runscargo test -p openshell-supervisor-process --lib -- capability_bounding drop_privilegesunder that user on the bare runner. This exercises the exact
EPERM + non-emptycode path that caused the crash.
Testing
cargo test -p openshell-supervisor-process)rootless-capsCI job was verified on a fork:https://github.com/waynesun09/OpenShell/actions/runs/28475854485
CAP_SETPCAPis available (privileged CI)Checklist