MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / procfs_root_accessible

Function procfs_root_accessible

crates/openshell-supervisor-network/src/opa.rs:6133–6150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6131 /// with restricted ptrace scope, rootless containers).
6132 #[cfg(target_os = "linux")]
6133 fn procfs_root_accessible() -> bool {
6134 use std::os::unix::fs::symlink;
6135 let Ok(dir) = tempfile::tempdir() else {
6136 return false;
6137 };
6138 let target = dir.path().join("probe_target");
6139 let link = dir.path().join("probe_link");
6140 if std::fs::write(&target, b"probe").is_err() {
6141 return false;
6142 }
6143 if symlink(&target, &link).is_err() {
6144 return false;
6145 }
6146 let pid = std::process::id();
6147 let link_path = link.to_string_lossy().to_string();
6148 // Actually attempt the same resolution our production code uses
6149 resolve_binary_in_container(&link_path, pid).is_some()
6150 }
6151
6152 #[cfg(target_os = "linux")]
6153 #[test]

Calls 2

pathMethod · 0.80