[lkml]   [2019]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] signal: always allocate siginfo for SI_TKILL
The patch titled
`signal: Never allocate siginfo for SIGKILL or SIGSTOP`
created a regression for users of PTRACE_GETSIGINFO needing to
discern signals that were raised via the tgkill syscall.

A notable user of this tgkill+ptrace combination is lldb while
debugging a multithreaded program. Without the ability to detect a
SIGSTOP originating from tgkill, lldb does not have a way to
synchronize on a per-thread basis and falls back to SIGSTOP-ing the
entire process.

This patch allocates the siginfo as it did previously whenever the
SI_TKILL code is present.

Signed-off-by: Jack Andersen <>
kernel/signal.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9a32bc2088c9..7a810aefb5df 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1058,9 +1058,11 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
* Skip useless siginfo allocation for SIGKILL SIGSTOP,
- * and kernel threads.
+ * and kernel threads. SI_TKILL is an exception to allow
+ * processes to discern signals originating from tgkill.
- if (sig_kernel_only(sig) || (t->flags & PF_KTHREAD))
+ if ((sig_kernel_only(sig) && info->si_code != SI_TKILL) ||
+ (t->flags & PF_KTHREAD))
goto out_set;

 \ /
  Last update: 2019-02-03 08:51    [W:0.128 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site