diff options
author | Kirill Korotaev <dev@sw.ru> | 2005-05-24 22:29:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-24 23:08:13 -0400 |
commit | c33880aaddbbab1ccf36f4457ed1090621f2e39a (patch) | |
tree | 2bcaa297c0688c3ce997ede15bf224c39fee6e23 | |
parent | 6431e6a28e8df423e1ebcda065e9ff086198d2c6 (diff) |
[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: Kirill Korotaev <dev@sw.ru>
Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | kernel/signal.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 8f3debc77c5b..b3c24c732c5a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -522,7 +522,16 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, | |||
522 | { | 522 | { |
523 | int sig = 0; | 523 | int sig = 0; |
524 | 524 | ||
525 | sig = next_signal(pending, mask); | 525 | /* SIGKILL must have priority, otherwise it is quite easy |
526 | * to create an unkillable process, sending sig < SIGKILL | ||
527 | * to self */ | ||
528 | if (unlikely(sigismember(&pending->signal, SIGKILL))) { | ||
529 | if (!sigismember(mask, SIGKILL)) | ||
530 | sig = SIGKILL; | ||
531 | } | ||
532 | |||
533 | if (likely(!sig)) | ||
534 | sig = next_signal(pending, mask); | ||
526 | if (sig) { | 535 | if (sig) { |
527 | if (current->notifier) { | 536 | if (current->notifier) { |
528 | if (sigismember(current->notifier_mask, sig)) { | 537 | if (sigismember(current->notifier_mask, sig)) { |