Bug 1573090 - systemd crashes after double sending SIGBUS or SIGFPE
Summary: systemd crashes after double sending SIGBUS or SIGFPE
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-30 07:50 UTC by Lukas Herbolt
Modified: 2020-04-02 16:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-03 07:58:38 UTC
Target Upstream Version:


Attachments (Terms of Use)
vmcore dmesg (30.68 KB, text/plain)
2018-04-30 07:50 UTC, Lukas Herbolt
no flags Details

Description Lukas Herbolt 2018-04-30 07:50:53 UTC
Created attachment 1428700 [details]
vmcore dmesg

Description of problem:
systemd (pid 1) crashes after sending two SIGBUS or SIGFPE.

Version-Release number of selected component (if applicable):
[root@fastvm-rhel-7-2-25 ~]# rpm -q systemd
systemd-219-19.el7.x86_64
[root@fastvm-rhel-7-2-25 ~]# /usr/lib/systemd/systemd --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN

How reproducible:
everytime 

Steps to Reproduce:
1. boot system
2. kill -7 1 
3. kill -7 1 

Actual results:
systemd crashes which leads to crash of the system

Expected results:
no crash 

Additional info:
[ 2232.472981] systemd[1]: segfault at 7fff7d20cff0 ip 00007f095e63b1a7 sp 00007fff7d20cee0 error 6 in libc-2.17.so[7f095e5f4000+1b8000]
[ 2232.475325] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Comment 2 Jan Synacek 2018-05-03 07:58:38 UTC
(In reply to Lukas Herbolt from comment #0)
> Expected results:
> no crash 

How do you expect no crash after sending SIGBUS? The expected behavior on a linux kernel is to crash with a core dump.

Comment 3 Michal Sekletar 2018-05-09 09:45:07 UTC
[ 2232.475325] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Above shouldn't happen. Instead, systemd should invoke crash handling routine in which it forks off a new process which  (optionally) stores coredump and PID1 then enters a state in which does nothing except handling zombies (while (true) { wait() }).

PID1 must never call exit() or exit_group().

Comment 4 Lukas Herbolt 2018-05-25 09:40:35 UTC
(In reply to Jan Synacek from comment #2)
> (In reply to Lukas Herbolt from comment #0)
> > Expected results:
> > no crash 
> 
> How do you expect no crash after sending SIGBUS? The expected behavior on a
> linux kernel is to crash with a core dump.

When the pid 1 starts it sets a crash handler for signals:

SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT

After sending one of this it goes to freeze() where if it just waits for zombie process or ges to pause() and from there the original signal handler is no longer takes care about the signals. 


> [ 2232.475325] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

> Above shouldn't happen. Instead, systemd should invoke crash handling routine 
> in which it forks off a new process which  (optionally) stores coredump and 
> PID1 then enters a state in which does nothing except handling zombies (while 
> (true) { wait() }).

Yes, this is what is happening now. If I am reading the code correctly during the coredump handling the .sa_handler is set to nop_handler. So after the second SIGBUS or other from above mentioned signals the pid 1 dies. Which ends with crashed kernel.

I am not saying it is wrong behavior, but if it is desired, it should be in the documentation.


Note You need to log in before you can comment on or make changes to this bug.