Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-19 10:21:09 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-19 10:21:09 +0100
commit8c9f09c7b84f4ab401957df7b49e75b2cabee663 (patch)
tree0539750b99a50371a09c957d1324042ccec68fcf
parent08d03457aa642c82543eca6014d7c1a89c053245 (diff)
- signal: Restore the stop PTRACE_EVENT_EXIT (strace
threads-execve regression). - Delete patches.suse/revert-signal-Always-notice-exiting-tasks.patch.
-rw-r--r--patches.suse/revert-signal-Always-notice-exiting-tasks.patch38
-rw-r--r--patches.suse/signal-Restore-the-stop-PTRACE_EVENT_EXIT.patch55
-rw-r--r--series.conf2
3 files changed, 56 insertions, 39 deletions
diff --git a/patches.suse/revert-signal-Always-notice-exiting-tasks.patch b/patches.suse/revert-signal-Always-notice-exiting-tasks.patch
deleted file mode 100644
index 298dc8b0b0..0000000000
--- a/patches.suse/revert-signal-Always-notice-exiting-tasks.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From: Jiri Slaby <jslaby@suse.cz>
-Date: Tue, 19 Feb 2019 07:31:53 +0100
-Subject: Revert "signal: Always notice exiting tasks"
-Patch-mainline: not yet, under discussion
-References: strace threads-execve regression
-
-This reverts commit 1ab370e1385374f99386267d63a7af062ba06bd1, upstream
-commit 35634ffa1751b6efd8cf75010b509dcb0263e29b as it breaks strace.
-See:
-https://github.com/strace/strace/commit/2a50278b9#commitcomment-32367006
-
-Signed-off-by: Jiri Slaby <jslaby@suse.cz>
----
- kernel/signal.c | 6 ------
- 1 file changed, 6 deletions(-)
-
---- a/kernel/signal.c
-+++ b/kernel/signal.c
-@@ -2435,11 +2435,6 @@ relock:
- goto relock;
- }
-
-- /* Has this task already been marked for death? */
-- ksig->info.si_signo = signr = SIGKILL;
-- if (signal_group_exit(signal))
-- goto fatal;
--
- for (;;) {
- struct k_sigaction *ka;
-
-@@ -2543,7 +2538,6 @@ relock:
- continue;
- }
-
-- fatal:
- spin_unlock_irq(&sighand->siglock);
-
- /*
diff --git a/patches.suse/signal-Restore-the-stop-PTRACE_EVENT_EXIT.patch b/patches.suse/signal-Restore-the-stop-PTRACE_EVENT_EXIT.patch
new file mode 100644
index 0000000000..e0bfe0dc97
--- /dev/null
+++ b/patches.suse/signal-Restore-the-stop-PTRACE_EVENT_EXIT.patch
@@ -0,0 +1,55 @@
+From: "Eric W. Biederman" <ebiederm@xmission.com>
+Date: Mon, 11 Feb 2019 23:27:42 -0600
+Subject: signal: Restore the stop PTRACE_EVENT_EXIT
+Git-commit: cf43a757fd49442bc38f76088b70c2299eed2c2f
+Patch-mainline: v5.0-rc7
+References: strace threads-execve regression
+
+In the middle of do_exit() there is there is a call
+"ptrace_event(PTRACE_EVENT_EXIT, code);" That call places the process
+in TACKED_TRACED aka "(TASK_WAKEKILL | __TASK_TRACED)" and waits for
+for the debugger to release the task or SIGKILL to be delivered.
+
+Skipping past dequeue_signal when we know a fatal signal has already
+been delivered resulted in SIGKILL remaining pending and
+TIF_SIGPENDING remaining set. This in turn caused the
+scheduler to not sleep in PTACE_EVENT_EXIT as it figured
+a fatal signal was pending. This also caused ptrace_freeze_traced
+in ptrace_check_attach to fail because it left a per thread
+SIGKILL pending which is what fatal_signal_pending tests for.
+
+This difference in signal state caused strace to report
+strace: Exit of unknown pid NNNNN ignored
+
+Therefore update the signal handling state like dequeue_signal
+would when removing a per thread SIGKILL, by removing SIGKILL
+from the per thread signal mask and clearing TIF_SIGPENDING.
+
+Acked-by: Oleg Nesterov <oleg@redhat.com>
+Reported-by: Oleg Nesterov <oleg@redhat.com>
+Reported-by: Ivan Delalande <colona@arista.com>
+Cc: stable@vger.kernel.org
+Fixes: 35634ffa1751 ("signal: Always notice exiting tasks")
+Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ kernel/signal.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -2436,9 +2436,12 @@ relock:
+ }
+
+ /* Has this task already been marked for death? */
+- ksig->info.si_signo = signr = SIGKILL;
+- if (signal_group_exit(signal))
++ if (signal_group_exit(signal)) {
++ ksig->info.si_signo = signr = SIGKILL;
++ sigdelset(&current->pending.signal, SIGKILL);
++ recalc_sigpending();
+ goto fatal;
++ }
+
+ for (;;) {
+ struct k_sigaction *ka;
diff --git a/series.conf b/series.conf
index 8eb5b940f1..804b97ab7f 100644
--- a/series.conf
+++ b/series.conf
@@ -1188,7 +1188,7 @@
# Scheduler / Core
########################################################
patches.suse/setuid-dumpable-wrongdir
- patches.suse/revert-signal-Always-notice-exiting-tasks.patch
+ patches.suse/signal-Restore-the-stop-PTRACE_EVENT_EXIT.patch
patches.suse/0001-x86-speculation-Add-basic-IBRS-support-infrastructur.patch
patches.suse/0002-x86-speculation-Add-inlines-to-control-Indirect-Bran.patch