Commit 0974a9cadc7886f7baaa458bb0c89f5c5f9d458e

Authored by Richard Weinberger
1 parent dee20035b4

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 <richard@nod.at>

Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff

arch/um/os-Linux/skas/process.c
... ... @@ -54,7 +54,7 @@
54 54  
55 55 void wait_stub_done(int pid)
56 56 {
57   - int n, status, err;
  57 + int n, status, err, bad_stop = 0;
58 58  
59 59 while (1) {
60 60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
... ... @@ -74,6 +74,8 @@
74 74  
75 75 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
76 76 return;
  77 + else
  78 + bad_stop = 1;
77 79  
78 80 bad_wait:
79 81 err = ptrace_dump_regs(pid);
... ... @@ -83,7 +85,10 @@
83 85 printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
84 86 "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
85 87 status);
86   - fatal_sigsegv();
  88 + if (bad_stop)
  89 + kill(pid, SIGKILL);
  90 + else
  91 + fatal_sigsegv();
87 92 }
88 93  
89 94 extern unsigned long current_stub_stack(void);