Skip to content

Commit 5171739

Browse files
committed
fix possible hang
1 parent ed60a7f commit 5171739

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
@@ -211,6 +211,10 @@ pub unsafe fn init_sv() -> Result<(), SvInitError> {
211211
}
212212
}
213213
unistd::ForkResult::Child => {
214+
// Make sure we never get orphaned and stuck in SIGSTOP or similar
215+
// SAFETY: prctl PR_SET_PDEATHSIG is always safe to call
216+
let ret = libc::prctl(libc::PR_SET_PDEATHSIG, libc::SIGTERM);
217+
assert_eq!(ret, 0);
214218
// First make sure the parent succeeded with ptracing us!
215219
signal::raise(signal::SIGSTOP).unwrap();
216220
// If we're the child process, save the supervisor info

0 commit comments

Comments
 (0)