diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 2b5499ef..745e3a9a 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -9,6 +9,15 @@ type Error = Box; pub type Result = result::Result; fn build_command() -> Command { + // Anything that needs to spawn a child will need to give it permission to + // ptrace itself, as Yama LSM will normally only allow a parent to debug + // a child, not the other way around. + #[cfg(target_os = "linux")] + { + let rc = unsafe { libc::prctl(libc::PR_SET_PTRACER, libc::PR_SET_PTRACER_ANY) }; + assert_eq!(rc, 0); + } + let mut cmd; if let Some(binary) = std::env::var_os("TEST_HELPER") { cmd = Command::new(binary);