Skip to content

Commit 98e0acd

Browse files
committed
daemon: restore SIGTERM default handler in child process
process_io() loop doesn't check flag set by SIGTERM handler in the parent qrexec-daemon process. This results in child processes (for example handling socket service calls to dom0) effectively ignore SIGTERM. This subsequently cause system shutdown to wait (until finally sending SIGKILL). Fix this by restoring default SIGTERM handler in the child process. Fixes: f3a5784 "Avoid qrexec-client for VM -> dom0 calls"
1 parent fedd1cf commit 98e0acd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

daemon/qrexec-daemon.c

+3
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,7 @@ static void handle_execute_service(
12021202
{
12031203
int policy_pending_slot;
12041204
pid_t pid;
1205+
struct sigaction sa = { .sa_handler = SIG_DFL };
12051206

12061207
policy_pending_slot = find_policy_pending_slot();
12071208
if (policy_pending_slot < 0) {
@@ -1217,6 +1218,8 @@ static void handle_execute_service(
12171218
case 0:
12181219
if (atexit(null_exit))
12191220
_exit(QREXEC_EXIT_PROBLEM);
1221+
if (sigaction(SIGTERM, &sa, NULL))
1222+
LOG(WARNING, "Failed to restore SIGTERM handler: %d", errno);
12201223
handle_execute_service_child(remote_domain_id, remote_domain_name,
12211224
target_domain, service_name, request_id);
12221225
abort();

0 commit comments

Comments
 (0)