fix(supervisor): opt-in reconcile of drifted sandbox state ownership (#2336) - #2338
fix(supervisor): opt-in reconcile of drifted sandbox state ownership (#2336)#2338TonyLuo-NV wants to merge 1 commit into
Conversation
|
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. |
|
This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. |
4f521de to
4d80c35
Compare
|
Not stale — still waiting on maintainer review. Rebased onto current Summary for a reviewer: this is a default-off opt-in ( The open question from the description still stands, and it's the only thing blocking a decision: is an opt-in toggle the preferred stop-gap, or should this wait for the durable idmapped-mount / pinned uid-map fix in #2336? Happy to close this in favor of the durable fix if that's the direction — just needs a maintainer call. |
|
The red Evidence:
Caveat, so I'm not overstating it: I could not reproduce locally to confirm, because I don't have rerun rights on this repo ( |
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>
4d80c35 to
3ca287a
Compare
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