aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-05-17 08:21:01 -0400
committerRichard Weinberger <richard@nod.at>2013-07-19 04:45:18 -0400
commit0974a9cadc7886f7baaa458bb0c89f5c5f9d458e (patch)
treedaf5e00929c889654b8eb8974b9e42ca77deea70
parentdee20035b42d569984d2c16041b51e4d75e233b5 (diff)
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>
-rw-r--r--arch/um/os-Linux/skas/process.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 4625949bf1e4..441e4ba074f4 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)
54 54
55void wait_stub_done(int pid) 55void wait_stub_done(int pid)
56{ 56{
57 int n, status, err; 57 int n, status, err, bad_stop = 0;
58 58
59 while (1) { 59 while (1) {
60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); 60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
@@ -74,6 +74,8 @@ void wait_stub_done(int pid)
74 74
75 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) 75 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
76 return; 76 return;
77 else
78 bad_stop = 1;
77 79
78bad_wait: 80bad_wait:
79 err = ptrace_dump_regs(pid); 81 err = ptrace_dump_regs(pid);
@@ -83,7 +85,10 @@ bad_wait:
83 printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " 85 printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
84 "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, 86 "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
85 status); 87 status);
86 fatal_sigsegv(); 88 if (bad_stop)
89 kill(pid, SIGKILL);
90 else
91 fatal_sigsegv();
87} 92}
88 93
89extern unsigned long current_stub_stack(void); 94extern unsigned long current_stub_stack(void);