(target: &CString)
| 402 | |
| 403 | #[cfg(target_os = "linux")] |
| 404 | fn mount_empty_tmpfs(target: &CString) -> std::io::Result<()> { |
| 405 | #[allow(unsafe_code)] |
| 406 | let rc = unsafe { |
| 407 | let flags: libc::c_ulong = |
| 408 | libc::MS_NOSUID | libc::MS_NODEV | libc::MS_NOEXEC | libc::MS_RDONLY; |
| 409 | libc::mount( |
| 410 | c"tmpfs".as_ptr(), |
| 411 | target.as_ptr(), |
| 412 | c"tmpfs".as_ptr(), |
| 413 | flags, |
| 414 | c"mode=0555,size=4k".as_ptr().cast(), |
| 415 | ) |
| 416 | }; |
| 417 | if rc != 0 { |
| 418 | return Err(std::io::Error::other(format!( |
| 419 | "failed to hide supervisor identity mount from child process: {}", |
| 420 | std::io::Error::last_os_error() |
| 421 | ))); |
| 422 | } |
| 423 | Ok(()) |
| 424 | } |
| 425 | |
| 426 | /// Handle to a running process. |
| 427 | pub struct ProcessHandle { |
no outgoing calls
no test coverage detected