From 8d5f3c982aeb790a2d76b0b93400d0c2be4b88b7 Mon Sep 17 00:00:00 2001 From: Jimmy Tran Date: Mon, 17 Mar 2025 14:24:28 -0700 Subject: [PATCH] Handle sighandling.KillItself() return error. Call dumpAndPanicSyscallError for the rare case where we fail to kill the the Sentry upon detecting an unexpected stub exit. This will provide enough information determine if a panic occur due to failed SIGKILL attempt or an unexpected event. PiperOrigin-RevId: 737751257 --- pkg/sentry/platform/systrap/subprocess.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/platform/systrap/subprocess.go b/pkg/sentry/platform/systrap/subprocess.go index 0de9fb592..3a4416385 100644 --- a/pkg/sentry/platform/systrap/subprocess.go +++ b/pkg/sentry/platform/systrap/subprocess.go @@ -609,7 +609,11 @@ func (t *thread) unexpectedStubExit() { // these cases, we don't need to panic. There is no reasons to // think that something wrong in gVisor. log.Warningf("The ptrace stub process %v has been killed by SIGKILL.", t.tgid) - sighandling.KillItself() + err := sighandling.KillItself() + if err != nil { + t.dumpAndPanic(fmt.Sprintf( + "failed to kill the process %d:%d: %v", t.tgid, t.tid, err)) + } } t.dumpAndPanic(fmt.Sprintf("wait failed: the process %d:%d exited: %x (err %v)", t.tgid, t.tid, msg, err)) }