From 2a1303357c3d928cca95601241fc16baca0e5f41 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 16 Aug 2019 17:32:20 -0700 Subject: ptrace: detect if a stub process exited unexpectedly PiperOrigin-RevId: 263880577 --- pkg/sentry/platform/ptrace/subprocess.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/sentry/platform/ptrace') diff --git a/pkg/sentry/platform/ptrace/subprocess.go b/pkg/sentry/platform/ptrace/subprocess.go index 79501682d..6bf7cd097 100644 --- a/pkg/sentry/platform/ptrace/subprocess.go +++ b/pkg/sentry/platform/ptrace/subprocess.go @@ -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) } -- cgit v1.2.3