summaryrefslogtreecommitdiffstats
path: root/src/shared/exec-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-23 11:36:44 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-23 11:39:45 +0200
commitcbcf371abc328167fa869721c1add4850c793240 (patch)
treec56e231ce62f5a645b25616fb026e6c87f0b6ce3 /src/shared/exec-util.c
parentMove freeze() into shared/ (diff)
downloadsystemd-cbcf371abc328167fa869721c1add4850c793240.tar.xz
systemd-cbcf371abc328167fa869721c1add4850c793240.zip
Add variant of close_all_fds() that does not allocate and use it in freeze()
Even though it's just a fallback path, let's not be sloppy and allocate in the crash handler. > The deadlock happens because systemd crash in malloc() then in signal > handler, it calls malloc() (close_all_fds()-> opendir()-> __alloc_dir()) > again. malloc() is not a signal-safe function, maybe we should re-think > the logic here. Fixes #20266.
Diffstat (limited to '')
-rw-r--r--src/shared/exec-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index 42f6c4d75a..cffa3fe96e 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -452,7 +452,7 @@ _noreturn_ void freeze(void) {
log_close();
/* Make sure nobody waits for us on a socket anymore */
- (void) close_all_fds(NULL, 0);
+ (void) close_all_fds_full(NULL, 0, false);
sync();