Commit c33880aa authored by Kirill Korotaev's avatar Kirill Korotaev Committed by Linus Torvalds

[PATCH] sigkill priority fix

If SIGKILL does not have priority, we cannot instantly kill task before it
makes some unexpected job.  It can be critical, but we were unable to
reproduce this easily until Heiko Carstens <Heiko.Carstens@de.ibm.com>
reported this problem on LKML.
Signed-Off-By: default avatarKirill Korotaev <dev@sw.ru>
Signed-Off-By: default avatarAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6431e6a2
...@@ -522,6 +522,15 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, ...@@ -522,6 +522,15 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
{ {
int sig = 0; int sig = 0;
/* SIGKILL must have priority, otherwise it is quite easy
* to create an unkillable process, sending sig < SIGKILL
* to self */
if (unlikely(sigismember(&pending->signal, SIGKILL))) {
if (!sigismember(mask, SIGKILL))
sig = SIGKILL;
}
if (likely(!sig))
sig = next_signal(pending, mask); sig = next_signal(pending, mask);
if (sig) { if (sig) {
if (current->notifier) { if (current->notifier) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment