[LibOS] Do not recursively send KILL messages via Graphene's IPC

Previously, Graphene not only broadcasted the KILL_ALL message via
its IPC mechanism to direct children and the parent (and they
broadcasted to their children and parents in turn), but also sent
additional KILL messages to all processes. These additional KILL
messages triggered the FINDNS/TELLNS IPC mechanism to find the
corresponding PID leaders. However, FINDNS/TELLNS are sent with
acknowledgements, forcing the sending thread to wait on futex.
This led to segfaults/hangs due to recursive IPC (e.g., in Apache
web server after user sends SIGINT to terminate the process).

This commit fixes this bug by *not* sending additional KILL
messages to other processes (the process already broadcasted
KILL_ALL).
This commit is contained in:
Dmitrii Kuvaiskii
2020-08-31 16:12:18 +00:00
parent aabe845ee5
commit bdddc8401f
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ int ipc_pid_kill_callback(struct shim_ipc_msg* msg, struct shim_ipc_port* port)
break;
case KILL_ALL:
broadcast_ipc(msg, IPC_PORT_DIRCLD | IPC_PORT_DIRPRT, port);
ret = do_kill_proc(msgin->sender, msgin->id, msgin->signum, true);
ret = do_kill_proc(msgin->sender, msgin->id, msgin->signum, false);
break;
}
return ret;
+1 -1
View File
@@ -376,7 +376,7 @@ int shim_do_kill(pid_t pid, int sig) {
/* If `pid` equals -1, then signal is sent to every process for which the calling process
* has permission to send, which means all processes in Graphene. */
ipc_pid_kill_send(cur->tid, /*target=*/0, KILL_ALL, sig);
return do_kill_proc(cur->tid, cur->tgid, sig, true);
return do_kill_proc(cur->tid, cur->tgid, sig, false);
} else if (pid == 0) {
/* If `pid` equals 0, then signal is sent to every process in the process group of
* the calling process. */