fix(supervisor): opt-in reconcile of drifted sandbox state ownership (#2336)#2338
Open
TonyLuo-NV wants to merge 1 commit into
Open
fix(supervisor): opt-in reconcile of drifted sandbox state ownership (#2336)#2338TonyLuo-NV wants to merge 1 commit into
TonyLuo-NV wants to merge 1 commit into
Conversation
Rootless Podman/Docker sandboxes attach no pinned user-namespace mapping and bind-mount host state as plain rbinds, so a persisted state tree can come back owned by an unrelated host user after a host reboot shifts the rootless subuid base -- leaving the sandbox unable to read its own state (readonly sqlite, EACCES). prepare_filesystem only chowns newly-created read_write paths, so an existing tree is never repaired. Add an opt-in OPENSHELL_RECONCILE_SANDBOX_OWNERSHIP toggle (default off). When enabled, prepare_filesystem recursively re-owns an existing sandbox-writable path whose owner no longer matches the configured identity. A correctly-owned tree is skipped after a single stat, so healthy launches are a no-op and the existing create-only chown contract -- and its test -- are preserved. Symlinks are never followed. Only policy-declared read_write paths are considered. Contained stop-gap; the durable fix (pinning the userns mapping / idmapped mounts) is tracked in NVIDIA#2336. Signed-off-by: Tony Luo <xialuo@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
TonyLuo-NV
marked this pull request as ready for review
July 17, 2026 02:11
TonyLuo-NV
requested review from
a team,
derekwaynecarr,
maxamillion and
mrunalp
as code owners
July 17, 2026 02:11
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.
What & why
Fixes (partially, as a contained stop-gap) #2336.
On the rootless Podman/Docker drivers OpenShell attaches no pinned user-namespace mapping and bind-mounts host state as plain rbinds, so after a host reboot shifts the rootless subuid base a persisted sandbox state tree can come back owned by an unrelated host user (
root/systemd-network/dnsmasq) with restrictive modes. The sandbox can then no longer read its own state (readonly sqlite,EACCES). Todayprepare_filesystemonly chowns newly-createdread_writepaths, so an existing tree is never repaired. (Downstream report: NVIDIA/NemoClaw#6972.)Change
Add an opt-in, default-off toggle
OPENSHELL_RECONCILE_SANDBOX_OWNERSHIP. When set (1/true),prepare_filesystemrecursively re-owns an existing sandbox-writable (read_write) path whose owner no longer matches the configured sandbox identity, so a drifted tree becomes readable again under the current mapping.Deliberately conservative — it does not change existing behavior or architecture:
prepare_filesystem_skips_chown_for_existing_read_write_pathsstill passes.stat, so healthy launches are a no-op.chown_sandbox_homesymlink refusal).This is a mitigation that heals the symptom each launch; it does not pin the mapping. The durable fix (idmapped mounts / deterministic
--uidmap/--gidmap) is the architectural work tracked in #2336 and left to maintainers — hence draft, to confirm the toggle approach is wanted before polishing docs.Tests
cargo test -p openshell-supervisor-process -p openshell-core— all pass, including 5 new root-free unit tests:path_owner_matches_detects_current_and_mismatched_ownerpath_owner_matches_treats_symlink_as_matchingreconcile_read_write_ownership_is_noop_when_already_ownedreconcile_read_write_ownership_skips_missing_pathsreconcile_read_write_ownership_triggers_on_mismatchand the preserved
prepare_filesystem_skips_chown_for_existing_read_write_paths.cargo fmt --checkandcargo clippy --all-targetsclean on both crates.Open questions for maintainers
/sandbox(currently gated onOPENSHELL_SANDBOX_UID) for the rootless drivers?Signed-off-by: Tony Luo xialuo@nvidia.com