Re: 2.6.1-mm4

From: Rusty Russell
Date: Mon Jan 19 2004 - 06:34:54 EST


In message <20040117105239.0b94f2b3.akpm@xxxxxxxx> you write:
> Yes. ksoftirqd and the migration threads can now be killed off
> with `kill -9'.

Fix below.

Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Block Signals For Early Kthreads
Author: Rusty Russell
Status: Booted on 2.6.1-bk4
Depends: Hotcpu-New-Kthread/use-kthread-simple.patch.gz

D: Kthreads created at boot before "keventd" are spawned directly.
D: However, this means that they don't have all signals blocked, and
D: hence can be killed. The simplest solution is to always explicitly
D: block all signals in the kthread.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .29870-linux-2.6.1-mm4/kernel/kthread.c .29870-linux-2.6.1-mm4.updated/kernel/kthread.c
--- .29870-linux-2.6.1-mm4/kernel/kthread.c 2004-01-19 18:12:53.000000000 +1100
+++ .29870-linux-2.6.1-mm4.updated/kernel/kthread.c 2004-01-19 21:45:53.000000000 +1100
@@ -32,12 +32,18 @@ static int kthread(void *_create)
struct kthread_create_info *create = _create;
int (*threadfn)(void *data);
void *data;
+ sigset_t blocked;
int ret = -EINTR;

/* Copy data: it's on keventd's stack */
threadfn = create->threadfn;
data = create->data;

+ /* Block and flush all signals (in case we're not from keventd). */
+ sigfillset(&blocked);
+ sigprocmask(SIG_BLOCK, &blocked, NULL);
+ flush_signals(current);
+
/* OK, tell user we're spawned, wait for stop or wakeup */
__set_current_state(TASK_INTERRUPTIBLE);
complete(&create->started);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/