Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0974a9ca authored by Richard Weinberger's avatar Richard Weinberger
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: default avatarRichard Weinberger <richard@nod.at>
parent dee20035
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)

void wait_stub_done(int pid)
{
	int n, status, err;
	int n, status, err, bad_stop = 0;

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

	if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
		return;
	else
		bad_stop = 1;

bad_wait:
	err = ptrace_dump_regs(pid);
@@ -83,6 +85,9 @@ bad_wait:
	printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
	       "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
	       status);
	if (bad_stop)
		kill(pid, SIGKILL);
	else
		fatal_sigsegv();
}