Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-15 10:23:48 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-15 10:23:56 +0100
commit7bda75fcb68889e04e726369fe033c58bccedc31 (patch)
tree2487a547cf291aa770fcf9784474f0b8fc54007a
parent76bc284080a8554f70eb41cb54a33d97391de27f (diff)
signal: Always attempt to allocate siginfo for SIGSTOP
-rw-r--r--patches.kernel.org/4.20.9-010-signal-Always-attempt-to-allocate-siginfo-for-.patch77
-rw-r--r--series.conf1
2 files changed, 78 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.9-010-signal-Always-attempt-to-allocate-siginfo-for-.patch b/patches.kernel.org/4.20.9-010-signal-Always-attempt-to-allocate-siginfo-for-.patch
new file mode 100644
index 0000000000..1cb8f5ddd9
--- /dev/null
+++ b/patches.kernel.org/4.20.9-010-signal-Always-attempt-to-allocate-siginfo-for-.patch
@@ -0,0 +1,77 @@
+From: "Eric W. Biederman" <ebiederm@xmission.com>
+Date: Tue, 5 Feb 2019 07:19:11 -0600
+Subject: [PATCH] signal: Always attempt to allocate siginfo for SIGSTOP
+References: bnc#1012628
+Patch-mainline: 4.20.9
+Git-commit: a692933a87691681e880feb708081681ff32400a
+
+commit a692933a87691681e880feb708081681ff32400a upstream.
+
+Since 2.5.34 the code has had the potential to not allocate siginfo
+for SIGSTOP signals. Except for ptrace this is perfectly fine as only
+ptrace can use PTRACE_PEEK_SIGINFO and see what the contents of
+the delivered siginfo are.
+
+Users of PTRACE_PEEK_SIGINFO that care about the contents siginfo
+for SIGSTOP are rare, but they do exist. A seccomp self test
+has cared and lldb cares.
+
+Jack Andersen <jackoalan@gmail.com> writes:
+
+> 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.
+
+Everyone affected by this please note. The kernel can still fail to
+allocate a siginfo structure. The allocation is with GFP_KERNEL and
+is best effort only. If memory is tight when the signal allocation
+comes in this will fail to allocate a siginfo.
+
+So I strongly recommend looking at more robust solutions for
+synchronizing with a single thread such as PTRACE_INTERRUPT. Or if
+that does not work persuading your friendly local kernel developer to
+build the interface you need.
+
+Reported-by: Tycho Andersen <tycho@tycho.ws>
+Reported-by: Kees Cook <keescook@chromium.org>
+Reported-by: Jack Andersen <jackoalan@gmail.com>
+Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
+Reviewed-by: Christian Brauner <christian@brauner.io>
+Cc: stable@vger.kernel.org
+Fixes: f149b3155744 ("signal: Never allocate siginfo for SIGKILL or SIGSTOP")
+Fixes: 6dfc88977e42 ("[PATCH] shared thread signals")
+History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
+Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ kernel/signal.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/kernel/signal.c b/kernel/signal.c
+index 9a32bc2088c9..b8faaa7a2925 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -1057,10 +1057,9 @@ 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.
++ * Skip useless siginfo allocation for SIGKILL and kernel threads.
+ */
+- if (sig_kernel_only(sig) || (t->flags & PF_KTHREAD))
++ if ((sig == SIGKILL) || (t->flags & PF_KTHREAD))
+ goto out_set;
+
+ /*
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 87e20e5d8c..a514839927 100644
--- a/series.conf
+++ b/series.conf
@@ -1092,6 +1092,7 @@
patches.kernel.org/4.20.9-007-iio-adc-axp288-Fix-TS-pin-handling.patch
patches.kernel.org/4.20.9-008-iio-chemical-atlas-ph-sensor-correct-IIO_TEMP-.patch
patches.kernel.org/4.20.9-009-iio-ti-ads8688-Update-buffer-allocation-for-ti.patch
+ patches.kernel.org/4.20.9-010-signal-Always-attempt-to-allocate-siginfo-for-.patch
########################################################
# Build fixes that apply to the vanilla kernel too.