diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2007-05-09 05:34:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:53 -0400 |
commit | 10ab825bdef8df510f99c703a5a2d9b13a4e31a5 (patch) | |
tree | e4db81f26c03ba5a5bff43ed44646a4ed4509d67 /kernel/exit.c | |
parent | 5de18d169739293e27e0cf9acfc75a2d2f4aa572 (diff) |
change kernel threads to ignore signals instead of blocking them
Currently kernel threads use sigprocmask(SIG_BLOCK) to protect against
signals. This doesn't prevent the signal delivery, this only blocks
signal_wake_up(). Every "killall -33 kthreadd" means a "struct siginfo"
leak.
Change kthreadd_setup() to set all handlers to SIG_IGN instead of blocking
them (make a new helper ignore_signals() for that). If the kernel thread
needs some signal, it should use allow_signal() anyway, and in that case it
should not use CLONE_SIGHAND.
Note that we can't change daemonize() (should die!) in the same way,
because it can be used along with CLONE_SIGHAND. This means that
allow_signal() still should unblock the signal to work correctly with
daemonize()ed threads.
However, disallow_signal() doesn't block the signal any longer but ignores
it.
NOTE: with or without this patch the kernel threads are not protected from
handle_stop_signal(), this seems harmless, but not good.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index bc982cd72743..b0c6f0c3a2df 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -347,7 +347,7 @@ int disallow_signal(int sig) | |||
347 | return -EINVAL; | 347 | return -EINVAL; |
348 | 348 | ||
349 | spin_lock_irq(¤t->sighand->siglock); | 349 | spin_lock_irq(¤t->sighand->siglock); |
350 | sigaddset(¤t->blocked, sig); | 350 | current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN; |
351 | recalc_sigpending(); | 351 | recalc_sigpending(); |
352 | spin_unlock_irq(¤t->sighand->siglock); | 352 | spin_unlock_irq(¤t->sighand->siglock); |
353 | return 0; | 353 | return 0; |