Skip to content

Commit 73c5f2d

Browse files
elezarrrhubenov
authored andcommitted
fix(sandbox): restore GPU procfs baseline (#1522)
Signed-off-by: Evan Lezar <[email protected]> (cherry picked from commit 5102cb9) Signed-off-by: Radoslav Hubenov <[email protected]>
1 parent 26bc05c commit 73c5f2d

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

  • crates/openshell-sandbox/src

‎crates/openshell-sandbox/src/lib.rs‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ where
780780
}
781781
}
782782
for path in rw {
783-
if fs.read_only.iter().any(|p| p == path) || fs.read_write.iter().any(|p| p == path) {
783+
if fs.read_write.iter().any(|p| p == path) {
784784
continue;
785785
}
786786
if !path_exists(path) {
@@ -790,6 +790,18 @@ where
790790
);
791791
continue;
792792
}
793+
if fs.read_only.iter().any(|p| p == path) {
794+
if path == "/proc" {
795+
info!(
796+
path,
797+
"Promoting /proc from read-only to read-write for GPU runtime compatibility"
798+
);
799+
fs.read_only.retain(|p| p != path);
800+
fs.read_write.push(path.clone());
801+
modified = true;
802+
}
803+
continue;
804+
}
793805
fs.read_write.push(path.clone());
794806
modified = true;
795807
}
@@ -993,7 +1005,7 @@ mod baseline_tests {
9931005
}
9941006

9951007
#[test]
996-
fn proto_gpu_enrichment_adds_devices_without_network_policy() {
1008+
fn proto_gpu_enrichment_promotes_proc_without_network_policy() {
9971009
let mut policy = openshell_policy::restrictive_default_policy();
9981010
assert!(
9991011
policy.network_policies.is_empty(),
@@ -1015,6 +1027,14 @@ mod baseline_tests {
10151027
filesystem.read_write.contains(&"/dev/nvidia0".to_string()),
10161028
"GPU enrichment should add enumerated device nodes without network policies"
10171029
);
1030+
assert!(
1031+
!filesystem.read_only.contains(&"/proc".to_string()),
1032+
"GPU enrichment should remove /proc from read_only"
1033+
);
1034+
assert!(
1035+
filesystem.read_write.contains(&"/proc".to_string()),
1036+
"GPU enrichment should promote /proc to read_write"
1037+
);
10181038
}
10191039

10201040
#[test]

0 commit comments

Comments
 (0)