Skip to content

Commit 0974a9c

Browse files
um: Fix wait_stub_done() error handling
If we die within a stub handler we only way to reliable kill the (obviously) dying uml guest process is killing it's host twin on the host side. Signed-off-by: Richard Weinberger <[email protected]>
1 parent dee2003 commit 0974a9c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/um/os-Linux/skas/process.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)
5454

5555
void wait_stub_done(int pid)
5656
{
57-
int n, status, err;
57+
int n, status, err, bad_stop = 0;
5858

5959
while (1) {
6060
CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
@@ -74,6 +74,8 @@ void wait_stub_done(int pid)
7474

7575
if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
7676
return;
77+
else
78+
bad_stop = 1;
7779

7880
bad_wait:
7981
err = ptrace_dump_regs(pid);
@@ -83,7 +85,10 @@ void wait_stub_done(int pid)
8385
printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
8486
"pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
8587
status);
86-
fatal_sigsegv();
88+
if (bad_stop)
89+
kill(pid, SIGKILL);
90+
else
91+
fatal_sigsegv();
8792
}
8893

8994
extern unsigned long current_stub_stack(void);

0 commit comments

Comments
 (0)