From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
"Eric W. Biederman" <ebiederm@xmission.com>
Cc: security@kernel.org, "Robert O'Callahan" <robert@ocallahan.org>,
Kees Cook <keescook@chromium.org>,
Andy Lutomirski <luto@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>, Kyle Huey <me@kylehuey.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] protect the traced SIGNAL_UNKILLABLE tasks from SIGKILL
Date: Fri, 3 Nov 2017 19:42:06 +0100 [thread overview]
Message-ID: <20171103184206.GB21036@redhat.com> (raw)
In-Reply-To: <20171103184144.GA21036@redhat.com>
The comment in sig_ignored() says "Tracers may want to know about
even ignored signals" but SIGKILL can not be reported to debugger
and it is just wrong to return 0 in this case: SIGKILL should only
kill the SIGNAL_UNKILLABLE task if it comes from the parent ns.
Change sig_ignored() to ignore ->ptrace if sig == SIGKILL and rely
on sig_task_ignored().
SISGTOP coming from within the namespace is not really right too
but at least debugger can intercept it, and we can't drop it here
because this will break "gdb -p 1": ptrace_attach() won't work.
Perhaps we will add another ->ptrace check later, we will see.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index 800a18f..b9aebe1 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -94,13 +94,15 @@ static int sig_ignored(struct task_struct *t, int sig, bool force)
if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig))
return 0;
- if (!sig_task_ignored(t, sig, force))
- return 0;
-
/*
- * Tracers may want to know about even ignored signals.
+ * Tracers may want to know about even ignored signal unless it
+ * is SIGKILL which can't be reported anyway but can be ignored
+ * by SIGNAL_UNKILLABLE task.
*/
- return !t->ptrace;
+ if (t->ptrace && sig != SIGKILL)
+ return 0;
+
+ return sig_task_ignored(t, sig, force);
}
/*
--
2.5.0
next prev parent reply other threads:[~2017-11-03 18:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAP045Ap9Xv67GaeskDt_gAajp1Cni_S0Z0u_vsuw_ptRUuJD6Q@mail.gmail.com>
[not found] ` <20171102160705.GA11973@redhat.com>
2017-11-03 18:41 ` [PATCH 0/3] fix SIGNAL_UNKILLABLE && SIGKILL interaction Oleg Nesterov
2017-11-03 18:42 ` Oleg Nesterov [this message]
2017-11-03 18:42 ` [PATCH 2/3] protect the SIGNAL_UNKILLABLE tasks from !sig_kernel_only() signals Oleg Nesterov
2017-11-03 18:42 ` [PATCH 3/3] remove the no longer needed SIGNAL_UNKILLABLE check in complete_signal() Oleg Nesterov
2017-11-03 19:14 ` Kees Cook
2017-11-13 14:53 ` [PATCH 0/3] fix SIGNAL_UNKILLABLE && SIGKILL interaction Oleg Nesterov
2017-11-13 20:00 ` Kyle Huey
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=20171103184206.GB21036@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=me@kylehuey.com \
--cc=robert@ocallahan.org \
--cc=security@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox