public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Sending signals to a kernel thread, broken in 2.6.22
@ 2007-05-29 20:55 Alan Stern
  2007-05-30 12:38 ` Nigel Cunningham
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Stern @ 2007-05-29 20:55 UTC (permalink / raw)
  To: Kernel development list

The g_file_storage driver uses a kernel thread and communicates with
that thread in part by means of signals.  It also relies on the thread 
receiving signals from userspace as an indication that the thread 
should terminate.

This was all working in 2.6.21, but as of 2.6.22-rc3 the signal 
delivery mechanism (entirely within the kernel!) is no longer 
functional.

What's the story?  Do I need to do something new and different to get 
signals working again?  Should I avoid using signals entirely?

Thanks for any help,

Alan Stern


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Sending signals to a kernel thread, broken in 2.6.22
@ 2007-05-30 11:22 Oleg Nesterov
  2007-05-30 12:33 ` Oleg Nesterov
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Nesterov @ 2007-05-30 11:22 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-kernel

Alan Stern wrote:
>
> The g_file_storage driver uses a kernel thread and communicates with
> that thread in part by means of signals.  It also relies on the thread
> receiving signals from userspace as an indication that the thread
> should terminate.
>
> This was all working in 2.6.21, but as of 2.6.22-rc3 the signal
> delivery mechanism (entirely within the kernel!) is no longer
> functional.
>
> What's the story?  Do I need to do something new and different to get
> signals working again?  Should I avoid using signals entirely?

I guess you mean drivers/usb/gadget/file_storage.c

	fsg_main_thread:
		
		siginitsetinv(&fsg->thread_signal_mask, SIGTERM | ...);
		sigprocmask(SIG_SETMASK, &fsg->thread_signal_mask, NULL);

Yes?

Please look at

	change kernel threads to ignore signals instead of blocking them
	commit: 10ab825bdef8df510f99c703a5a2d9b13a4e31a5

I think you can convert the code above to use allow_signal().


Please note that it is not good to just unblock the signal, SIG_DFL means
that __group_complete_signal() starts doing SIGNAL_GROUP_EXIT things. In
particular, SIGTERM implies sigaddset(SIGKILL).

Oleg.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-05-30 22:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 20:55 Sending signals to a kernel thread, broken in 2.6.22 Alan Stern
2007-05-30 12:38 ` Nigel Cunningham
2007-05-30 14:51   ` Alan Stern
2007-05-30 22:22     ` Nigel Cunningham
2007-05-30 20:09   ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2007-05-30 11:22 Oleg Nesterov
2007-05-30 12:33 ` Oleg Nesterov
2007-05-30 14:57   ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox