OSDN Git Service

signal: Never allocate siginfo for SIGKILL or SIGSTOP
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 3 Sep 2018 07:50:36 +0000 (09:50 +0200)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 11 Sep 2018 19:19:28 +0000 (21:19 +0200)
The SIGKILL and SIGSTOP signals are never delivered to userspace so
queued siginfo for these signals can never be observed.  Therefore
remove the chance of failure by never even attempting to allocate
siginfo in those cases.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/signal.c

index 20931a8..d7d1adf 100644 (file)
@@ -1054,10 +1054,11 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 
        result = TRACE_SIGNAL_DELIVERED;
        /*
-        * fast-pathed signals for kernel-internal things like SIGSTOP
-        * or SIGKILL.
+        * Skip useless siginfo allocation for SIGKILL SIGSTOP,
+        * and kernel threads.
         */
-       if ((info == SEND_SIG_FORCED) || (t->flags & PF_KTHREAD))
+       if ((info == SEND_SIG_FORCED) ||
+           sig_kernel_only(sig) || (t->flags & PF_KTHREAD))
                goto out_set;
 
        /*