]> git.ipfire.org Git - thirdparty/systemd.git/commit
Add variant of close_all_fds() that does not allocate and use it in freeze() 20288/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Jul 2021 09:36:44 +0000 (11:36 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Jul 2021 09:39:45 +0000 (11:39 +0200)
commitcbcf371abc328167fa869721c1add4850c793240
treec56e231ce62f5a645b25616fb026e6c87f0b6ce3
parent45a68ed3073a006c44703acf2928be156805ef9f
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.
src/basic/fd-util.c
src/basic/fd-util.h
src/shared/exec-util.c