From aa0aa1093d646f3efbcbc9cf09476ee032839bdd Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Thu, 24 Oct 2024 12:24:35 -0400 Subject: [PATCH] posix_spawn_wrapper: do not set POSIX_SPAWN_SETSIGDEF flag Setting this flag is a noop without a corresponding call to posix_spawnattr_setsigdefault. If we call posix_spawnattr_setsigdefault with a full signal set, it causes glibc's posix_spawn implementation to call sigaction 63 times, once for each signal. That seems wasteful. This feature is really only useful for signals which have their disposition set to SIG_IGN. Otherwise the dispostion gets set to SIG_DFL automatically, either by clone(CLONE_CLEAR_SIGHAND) or the subsequent execve. As far as I can tell, systemd does not have any signals set to SIG_IGN under normal operating conditions. (cherry picked from commit ff94426f8a2d6cd4ea2e370835db152917a1684e) --- src/basic/process-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index de5a1469b9..d9e8bc9fc9 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -2036,7 +2036,7 @@ int posix_spawn_wrapper( const char *cgroup, PidRef *ret_pidref) { - short flags = POSIX_SPAWN_SETSIGMASK|POSIX_SPAWN_SETSIGDEF; + short flags = POSIX_SPAWN_SETSIGMASK; posix_spawnattr_t attr; sigset_t mask; int r; -- 2.25.1