Re: khubd zombie

Patrik Weiskircher
2002-02-18T19:57:19Z

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

On Mon, 2002-02-18 at 19:14, Greg KH wrote:
> On Mon, Feb 18, 2002 at 02:33:13PM +0100, Patrik Weiskircher wrote:
> > killall khubd results to:
> > 10 ? Z 0:00 [khubd <defunct>]
> >
> > is this ok?
> > if not, how can i solve this?
>
> What kernel version is this?
> And why are you trying to kill khubd from userspace? Unloading the
> usbcore module will do the same thing.
>
> thanks,
>
> greg k-h

I tried it with 2.4.5, 2.4.12, 2.4.17.
And I have to kill everything except init.
I need a "clean" system.

Anyway, I don't think that it should behave like that.
Killing something from userspace should not affect the kernel, or did I
miss something?

I fixed it, it works, patch file attached.

Best Regards,
Patrik

[-- Attachment #2: hub.c.patch --]
[-- Type: text/x-patch, Size: 826 bytes --]

diff -Naur linux-2.4.17/drivers/usb/hub.c linux/drivers/usb/hub.c
--- linux-2.4.17/drivers/usb/hub.c Mon Feb 18 20:43:48 2002
+++ linux/drivers/usb/hub.c Mon Feb 18 20:38:50 2002
@@ -826,6 +826,8 @@

static int usb_hub_thread(void *__hub)
{
+ struct task_struct *tsk = current;
+
lock_kernel();

/*
@@ -835,6 +837,13 @@

daemonize();

+ /* avoid getting signals */
+ spin_lock_irq(&tsk->sigmask_lock);
+ flush_signals(tsk);
+ sigfillset(&tsk->blocked);
+ recalc_sigpending(tsk);
+ spin_unlock_irq(&tsk->sigmask_lock);
+
/* Setup a nice name */
strcpy(current->comm, "khubd");

@@ -879,7 +888,7 @@
}

pid = kernel_thread(usb_hub_thread, NULL,
- CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ CLONE_FS | CLONE_FILES | CLONE_SIGNAL);
if (pid >= 0) {
khubd_pid = pid;