Conversation
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
|
Label |
|
Label |
|
Label |
|
Label |
|
🌿 Preview your docs: https://nvidia-preview-pr-4204.docs.buildwithfern.com/openshell |
|
The new CDI spec bind mounts need to participate in the existing GPU trust exemption. With resource admission enabled by default, We can treat GPU attachments and their driver-managed CDI spec projections as trusted. Please have admission recognize and allow the exact expected CDI mounts by validating their daemon-reported source directory, reserved workload destination, and read-only mode. Keep rejecting arbitrary host binds, including on GPU sandboxes, rather than skipping admission for the entire container. Please also add a GPU provisioning/admission regression test with resource admission enabled; the current GPU test configuration disables it. |
drew
left a comment
There was a problem hiding this comment.
Reviewed at 966d8ea. I found two validation issues, detailed inline: library-parent expansion bypasses broad-path rejection, and implicitly writable mounts skip the new opt-in checks. Please add regression cases for both.
The overall design keeps Docker responsible for device injection and resolves policy requirements inside the workload namespace.
The Docker troubleshooting skill (skills/debug-openshell-cluster/SKILL.md) also needs a companion update covering CDI projection and supplemental-group failures.
Validation: static review only; I did not run tests. CI was still running when checked, and the PR description reports Docker GPU E2E validation as pending.
| for (path, access) in self.mount_paths { | ||
| match access { | ||
| CdiAccess::ReadOnly => { | ||
| read_only_paths.insert(shared_library_parent(&path).unwrap_or(path)); |
There was a problem hiding this comment.
Validate the derived library parent before adding it. Before this PR, GPU enrichment used a fixed allowlist. Now a read-only CDI destination such as /libexample.so passes normalize_policy_path() and then expands here to /, granting read access far beyond that library within the outer sandbox boundary. validate_cdi_requirements() only checks that the resulting directory exists, so it does not catch this. Apply the broad-path rejection to the derived parent as well, and add a regression case for a library directly beneath / (and other rejected roots).
| if read_write_requested { | ||
| Ok(CdiAccess::ReadWrite) | ||
| } else { | ||
| Ok(CdiAccess::ReadOnly) |
There was a problem hiding this comment.
Do not infer read-only access from the absence of rw. This classifies options: [bind] or [rbind] as read-only, although a bind mount can preserve a writable source mount. Consequently, these mounts never reach the single-file and exact-path allowlist checks. For example, a writable CDI directory mounted at /tmp/device-data remains writable under an existing /tmp read-write policy, despite the new contract rejecting writable CDI directories. Require explicit read-only semantics or conservatively validate the mount as writable, with regression coverage for omitted ro/rw options. See Linux bind-mount semantics.
Summary
Derive Docker GPU sandbox access from the selected CDI specifications so device nodes, library mounts, and supplemental group requirements reach the workload's policy boundary. This combines the core resolver, sandbox consumer, and Docker producer into one reviewable change.
Related Issue
Related to #1606 (currently closed). Supersedes #2775, #2776, and #2265. The standard-sbin PATH repair remains a separate follow-up in #2846.
Changes
Testing
mise run pre-commitpasses after rebasing ontoorigin/mainat07a05f856.cargo test --locked -p openshell-core -p openshell-policy -p openshell-sandbox -p openshell-driver-dockerpasses.cargo test --locked -p openshell-supervisor-process -p openshell-sandbox-backendpasses on the combined branch.mise run ci: attempted; stops on an existing assertion intest:packaging-assetsbecausetests/ansible/roles/openshell_packaged_gateway/tasks/main.yamlcontains/var/lib/openshell-qualification/gateway.toml. Both files are unchanged from currentorigin/main.Checklist