Skip to content

Commit eaea656

Browse files
committed
fix possible hang
1 parent 18316fc commit eaea656

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/shims/trace/child.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ pub unsafe fn init_sv() -> Result<(), SvInitError> {
220220
}
221221
}
222222
unistd::ForkResult::Child => {
223+
// Make sure we never get orphaned and stuck in SIGSTOP or similar
224+
// SAFETY: prctl PR_SET_PDEATHSIG is always safe to call
225+
let ret = libc::prctl(libc::PR_SET_PDEATHSIG, libc::SIGTERM);
226+
assert_ne!(ret, 0);
223227
// First make sure the parent succeeded with ptracing us!
224228
signal::raise(signal::SIGSTOP).unwrap();
225229
// If we're the child process, save the supervisor info

0 commit comments

Comments
 (0)