The Linux Programming Interface says:
TASK_KILLABLE : This state is like TASK_UNINTERRUPTIBLE , but wakes the process if a fatal signal (i.e., one that would kill the process) is received. By converting relevant parts of the kernel code to use this state, various scenarios where a hung process requires a system restart can be avoided. Instead, the process can be killed by sending it a fatal signal. The first piece of kernel code to be converted to use TASK_KILLABLE was NFS.
A fatal signal can wake up a process in TASK_KILLABLE but not in TASK_UNINTERRUPTIBLE.
Does a fatal signal mean only SIGKILL, or also SIGTERM, SIGHUP, SIGQUIT, SIGINT, or ...?
1 Answer 1
Most signals are fatal by default. Any signal listed with a default action of "terminate" or "dump core" is fatal, unless it’s ignored or handled explicitly. This includes such "benign" signals as SIGUSR1
, as well as SIGKILL
of course, SIGTERM
etc.
This matches the Linux kernel’s definition of fatal signals; for a signal to be fatal:
- it mustn’t be one of the ignored signals (from the kernel’s perspective) or one of the stop signals, i.e. respectively
SIGCONT
,SIGCHLD
,SIGWINCH
, andSIGURG
on the one hand, andSIGSTOP
,SIGTSTP
,SIGTTIN
, andSIGTTOU
on the other; - its signal handler must be the default handler.
Thus a fatal signal is one which would result in the process being killed (without going through a handler specified by the program being run).
-
1I assume
SIGKILL
is a fatal signal, but which other signals could be considered as such?nxnev– nxnev2018年12月24日 22:54:02 +00:00Commented Dec 24, 2018 at 22:54 -
Thanks. (1) "the ignored signals (from the kernel’s perspective)". Most signals can be ignored. But the first link you gave shows some specific signals, such as SIGCONT, SIGCHLD, SIGWINCH, and SIGURG. So what does "ignored" signal mean? (2) The first link you gave doesn't say anything like "a fatal signal is one which would result in the process being killed (without going through a handler specified by the program being run)". Can we derive that from the definition in the first quote?Tim– Tim2018年12月25日 06:03:35 +00:00Commented Dec 25, 2018 at 6:03
-
@nxnev any signal not listed as an ignored or stop signal is fatal by default.Stephen Kitt– Stephen Kitt2018年12月25日 08:35:03 +00:00Commented Dec 25, 2018 at 8:35
-
(1) It means that the kernel ignores them in this context, not that they’re configured as ignored signals. (Note that the list is static.) (2) The two bullet points retranscribe the code definition; that’s how we can derive the meaning of "fatal signal".Stephen Kitt– Stephen Kitt2018年12月25日 08:37:50 +00:00Commented Dec 25, 2018 at 8:37
-
Thanks. Fatal signals are defined in terms of default actions, and by set complement (not ignore, not stop or contonue, then only terminate and core)Tim– Tim2018年12月25日 19:05:45 +00:00Commented Dec 25, 2018 at 19:05