From 98e0acdb51fc51e2b02f936e3ded446c2730839f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 18 Aug 2024 02:18:33 +0200 Subject: [PATCH] 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" --- daemon/qrexec-daemon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/qrexec-daemon.c b/daemon/qrexec-daemon.c index 5dfbe3c1..61c1004f 100644 --- a/daemon/qrexec-daemon.c +++ b/daemon/qrexec-daemon.c @@ -1202,6 +1202,7 @@ static void handle_execute_service( { int policy_pending_slot; pid_t pid; + struct sigaction sa = { .sa_handler = SIG_DFL }; policy_pending_slot = find_policy_pending_slot(); if (policy_pending_slot < 0) { @@ -1217,6 +1218,8 @@ static void handle_execute_service( case 0: if (atexit(null_exit)) _exit(QREXEC_EXIT_PROBLEM); + if (sigaction(SIGTERM, &sa, NULL)) + LOG(WARNING, "Failed to restore SIGTERM handler: %d", errno); handle_execute_service_child(remote_domain_id, remote_domain_name, target_domain, service_name, request_id); abort();