From: Jack Andersen <jackoalan@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Christian Brauner <christian@brauner.io>,
Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
Jack Andersen <jackoalan@gmail.com>
Subject: [PATCH] signal: always allocate siginfo for SI_TKILL
Date: Sat, 2 Feb 2019 21:49:38 -1000 [thread overview]
Message-ID: <20190203074939.7261-1-jackoalan@gmail.com> (raw)
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 <jackoalan@gmail.com>
---
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
result = TRACE_SIGNAL_DELIVERED;
/*
* 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;
/*
--
2.20.1
next reply other threads:[~2019-02-03 7:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-03 7:49 Jack Andersen [this message]
2019-02-03 8:39 ` [PATCH] signal: always allocate siginfo for SI_TKILL Christian Brauner
2019-02-03 18:33 ` Kees Cook
2019-02-04 15:10 ` Christian Brauner
2019-02-05 2:41 ` Eric W. Biederman
2019-02-05 6:37 ` Linus Torvalds
2019-02-05 6:46 ` Eric W. Biederman
2019-02-05 14:16 ` [PATCH] signal: Always attempt to allocate siginfo for SIGSTOP Eric W. Biederman
2019-02-05 14:49 ` Kees Cook
2019-02-05 11:23 ` [PATCH] signal: always allocate siginfo for SI_TKILL Christian Brauner
2019-02-28 4:56 ` [signal] b3eedf8d5b: BUG:unable_to_handle_kernel kernel test robot
2019-02-28 4:56 ` [LKP] " kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190203074939.7261-1-jackoalan@gmail.com \
--to=jackoalan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.