Conversation
This branch has not been deployed
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
Fail closed when explicit security mount flags cannot be applied by the new mount API path.
This hardens nsjail against continuing with a mount when explicitly requested security properties such as
MS_NOSUID,MS_NODEV, orMS_NOEXECcould not actually be enforced.Problem
applyMountFlags()failures are currently logged, but mount setup may continue.For ordinary/non-security-related flags this can remain best-effort behavior, but when the configuration explicitly requests security-sensitive flags:
MS_NOSUIDMS_NODEVMS_NOEXECcontinuing after the flag application fails means the resulting mount may not have the security properties requested by the nsjail configuration.
This is fail-closed hardening; I am not claiming a sandbox escape.
Fix
For the new mount API paths in
mnt_newapi.cc:applyMountFlags()MS_NOSUID | MS_NODEV | MS_NOEXEC), abort mount setupfalseso sandbox setup does not continue with weaker-than-requested mount semanticsBest-effort behavior is preserved for flag failures that do not involve these explicit security flags.
Scope
The change is intentionally narrow.
It affects only:
mountDynamicContentAt()mountSinglePointAt()in the new mount API implementation.
It does not modify the legacy mount path or unrelated mount behavior.
Security rationale
When a sandbox configuration explicitly requests a security property, silently continuing after that property cannot be applied creates a mismatch between configured and effective isolation.
Failing closed makes the effective sandbox state consistent with the requested security policy.
Validation
The patch was tested against the upstream baseline with focused failure injection.
Observed behavior:
Baseline
Patched
The patch contains only the fail-closed handling required for these explicit security mount flags.