ptrace: detect if a stub process exited unexpectedly

PiperOrigin-RevId: 263880577
This commit is contained in:
Andrei Vagin
2019-08-16 17:33:28 -07:00
committed by gVisor bot
parent f7114e0a27
commit 2a1303357c
+3
View File
@@ -354,6 +354,9 @@ func (t *thread) wait(outcome waitOutcome) syscall.Signal {
continue // Spurious stop.
}
if stopSig == syscall.SIGTRAP {
if status.TrapCause() == syscall.PTRACE_EVENT_EXIT {
t.dumpAndPanic("wait failed: the process exited")
}
// Re-encode the trap cause the way it's expected.
return stopSig | syscall.Signal(status.TrapCause()<<8)
}