Skip to content

Commit

Permalink
daemon: restore SIGTERM default handler in child process
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
marmarek committed Aug 18, 2024
1 parent fedd1cf commit 98e0acd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions daemon/qrexec-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Check warning on line 1222 in daemon/qrexec-daemon.c

View check run for this annotation

Codecov / codecov/patch

daemon/qrexec-daemon.c#L1222

Added line #L1222 was not covered by tests
handle_execute_service_child(remote_domain_id, remote_domain_name,
target_domain, service_name, request_id);
abort();
Expand Down

0 comments on commit 98e0acd

Please sign in to comment.