Skip to content

Commit

Permalink
signal: Never allocate siginfo for SIGKILL or SIGSTOP
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Sep 11, 2018
1 parent 0351505 commit f149b31
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down

0 comments on commit f149b31

Please sign in to comment.