From: Chengwei Yang Date: Mon, 20 May 2013 07:22:27 +0000 (+0800) Subject: manager: Do not handle SIGKILL since we can not X-Git-Tag: v205~163 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=1cce5d639cdcb3b237e2eda3c36782f98ff23b46;hp=4a4c0be0ab713410ab65bb6bd0c0702abd9e9f4c;ds=inline manager: Do not handle SIGKILL since we can not This is a minor fix because it's not a major issue, this fix just avoid to get EINVAL error from sigaction(2). There are two signals can not handled at user space, SIGKILL and SIGSTOP even we're PID 1, trying to handle these two signals will get EINVAL error. There are two kinds of systemd instance, running as system manager or user session manager, apparently, the latter is a general user space process which can not handle SIGKILL. The special pid 1 also can not do that refer to kernel/signal.c:do_sigaction(). However, pid 1 is unkillable because the kernel did attach SIGNAL_UNKILLABLE to it at system boot up, refer to init/main.c:start_kernel() --> rest_init() --> kernel_thread() --> kernel_init() --> init_post() current->signal->flags |= SIGNAL_UNKILLABLE --- diff --git a/src/core/main.c b/src/core/main.c index bb7364054..26aa56121 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1405,7 +1405,6 @@ int main(int argc, char *argv[]) { /* Reset all signal handlers. */ assert_se(reset_all_signal_handlers() == 0); - /* If we are init, we can block sigkill. Yay. */ ignore_signals(SIGNALS_IGNORE, -1); if (parse_config_file() < 0) diff --git a/src/shared/def.h b/src/shared/def.h index 5ba170f96..5abb54424 100644 --- a/src/shared/def.h +++ b/src/shared/def.h @@ -32,4 +32,4 @@ #define SYSTEMD_CGROUP_CONTROLLER "name=systemd" #define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT -#define SIGNALS_IGNORE SIGKILL,SIGPIPE +#define SIGNALS_IGNORE SIGPIPE