Skip to contentSkip to conversation

khubd zombie

DISCUSSION Patrik Weiskircher 4 participants 9 messages Feb 18, 2002 – Feb 22, 2002 USB

lore
Share & tools
lore
#0 lore raw

killall khubd results to:
10 ? Z 0:00 [khubd <defunct>]

is this ok?
if not, how can i solve this?

Best Regards,
Patrik Weiskircher

#1 lore raw
Quoted 5 lines · Patrik Weiskircher

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

#2 lore raw
Quoted 7 lines · Greg KH
Quoted 5 lines · Patrik Weiskircher

killall khubd results to:
10 ? Z 0:00 [khubd <defunct>]

is this ok?
if not, how can i solve this?

Quoted 7 lines

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

drivers/usb/hub.c +10 -1
diff -Naur linux-2.4.17/drivers/usb/hub.c linux/drivers/usb/hub.c
@@ -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;
 
#3 lore raw
In reply to Patrik Weiskircher
Quoted 5 lines · Patrik Weiskircher

killall khubd results to:
10 ? Z 0:00 [khubd <defunct>]

is this ok?
if not, how can i solve this?

add reparent_to_init() in drivers/usb/hub.c (by the daemonize()).

I imagine the fix is sitting in some USB changes somewhere ...

john

Signature · 2 lines
"They eat cold meat for breakfast and make jokes about gzip."
	- Rik Hemsley on KDE developers
#4 lore raw
In reply to Patrik Weiskircher
Quoted 4 lines · Patrik Weiskircher

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.

What? You want to also get rid of keventd, ksoftirqd_CPUX, kswapd, and others and expect your machine to still work properly?

Quoted 3 lines

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?

This is a _kernel_ thread, not a userspace program running.

Quoted 1 line

I fixed it, it works, patch file attached.

And what happened to your USB devices when you kill khubd after applying your patch?

The reparent_to_init() seems like the better thing to do.

thanks,

greg k-h

#5 lore raw
Quoted 8 lines · Greg KH
Quoted 4 lines · Patrik Weiskircher

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.

What? You want to also get rid of keventd, ksoftirqd_CPUX, kswapd, and others and expect your machine to still work properly?

I just do a kill(-1,15);
It doesn't affect keventd, ksoftirqd_CPUX, etc. as far as i know. Except the khubd, it keeps getting a zombie.

Quoted 6 lines
Quoted 4 lines

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?

This is a _kernel_ thread, not a userspace program running.

khubd is a kernel thread, yes.
But if I issue a 'killall khubd' it shouldn't become a zombie.

Quoted 5 lines
Quoted 2 lines

I fixed it, it works, patch file attached.

And what happened to your USB devices when you kill khubd after applying your patch?

They work as always.

Quoted 3 lines

The reparent_to_init() seems like the better thing to do.

I have to admit, I'm really new to the kernel sources. There's still _very_ much I don't know about the kernel. These are the first steps in kernel programming. Sorry if it's the wrong way to do, I just try my best.

Quoted 3 lines

thanks,

greg k-h

Best Regards,
Patrik Weiskircher

#6 lore raw
In reply to Patrik Weiskircher
Quoted 3 lines · Patrik Weiskircher

khubd is a kernel thread, yes.
But if I issue a 'killall khubd' it shouldn't become a zombie.

Agreed. I'll look into this.

Quoted 4 lines
Quoted 2 lines

And what happened to your USB devices when you kill khubd after applying your patch?

They work as always.

Try removing a device, or plugging a new one in :)

greg k-h

#7 lore raw
Quoted 7 lines · Greg KH
Quoted 4 lines
Quoted 2 lines

And what happened to your USB devices when you kill khubd after applying your patch?

They work as always.

Try removing a device, or plugging a new one in :)

Without my patch, plugging a new one in doesn't work, after a killall khubd. with my patch it worked without a single problem. (with ohci, don't know if that matters.)

I'll do some more tests tomorrow morning. ;)

Thanks for your help so far,
Patrik