summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-08-16 17:32:20 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-16 17:33:28 -0700
commit2a1303357c3d928cca95601241fc16baca0e5f41 (patch)
tree1aa52744b2cd689ae8de273a855beda6f4c80ad0 /pkg
parentf7114e0a27db788af512af8678595954996bcd7f (diff)
ptrace: detect if a stub process exited unexpectedly
PiperOrigin-RevId: 263880577
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/platform/ptrace/subprocess.go3
1 files changed, 3 insertions, 0 deletions
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)
}