diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2016-05-21 19:40:34 +0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-05-21 12:40:34 -0400 |
commit | 3da48d7aa9438029f45b84124b825634c2f091dc (patch) | |
tree | 4a69cabead46b33a2a0bd72883fb3dcdc1b6f598 | |
parent | 508c45daa4e6381e5d3952ae4ff3d25f839dd97e (diff) |
core: set all log fds to -1 when freezing (#3314)
Fixes:
-bash-4.3# echo core >/proc/sys/kernel/core_pattern
-bash-4.3# kill -ABRT 1
-bash-4.3# kill -ABRT 1
[ 61.373922] systemd[1]: segfault at 7fff1d0a8f48 ip 00007fc9ca91b1c3 sp 00007fff1d0a8f50 error 6 in libc-2.23.so[7fc9ca8ce000+1c0000]
[ 61.768017] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000008b
[ 61.768017]
...
Recursive ABRT and segfault:
PID 1 - core
TID 1:
...
#153905 0x00005575fc3f829d log_dispatch
#153906 0x00005575fc3f8aa3 log_assert
#153907 0x00005575fc3f8ae9 log_assert_failed
#153908 0x00005575fc3e7eb1 safe_close
#153909 0x00005575fc3f6d5e log_close_journal
#153910 0x00005575fc3f829d log_dispatch
#153911 0x00005575fc3f85a1 log_internalv
#153912 0x00005575fc3f86a1 log_internal
#153913 0x00005575fc31c4c1 crash
#153914 0x00007fb26f2cf3d0 __restore_rt
#153915 0x00007fb26f2ced00 pause
#153916 0x00005575fc403944 freeze
#153917 0x00005575fc31bf7b freeze_or_reboot
...
-rw-r--r-- | src/basic/process-util.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 4a7367cc92..1ad8816206 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -667,6 +667,8 @@ bool is_main_thread(void) { noreturn void freeze(void) { + log_close(); + /* Make sure nobody waits for us on a socket anymore */ close_all_fds(NULL, 0); |