cvs commit: src/sys/kern kern_exit.c
Kostik Belousov
kostikbel at gmail.com
Sun Oct 22 06:27:36 UTC 2006
On Sun, Oct 22, 2006 at 01:54:57PM +0800, David Xu wrote:
> But I am still worrried by these signal changes, if an exiting process
> can be sent a signal, and msleep will interrupted in cleanup code, where the
> code will return to ? in normal case, code will return to userland, and
> signal will be removed and delivered, but if a thread is in exit1(), where
> the code can be returned to ? if a cleanup procedure is interrupted, isn't
> there is any resource leak or dead-loop if it is retried because signal is
> never removed ?
As noted in the original commit message, I asked for something related some
time ago. But, I wanted only to wake up the thread sleeping in exit code.
The scenario when this is needed is driver (or nfs client) sleeping in
file descriptors cleanup. Currently, such process may become unkillable.
I proposed the following change:
Index: kern_sig.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.332
diff -u -r1.332 kern_sig.c
--- kern_sig.c 5 Oct 2006 01:56:11 -0000 1.332
+++ kern_sig.c 22 Oct 2006 06:23:55 -0000
@@ -2126,8 +2126,7 @@
* action will be SIG_DFL here.)
*/
mtx_lock(&ps->ps_mtx);
- if (SIGISMEMBER(ps->ps_sigignore, sig) ||
- (p->p_flag & P_WEXIT)) {
+ if (SIGISMEMBER(ps->ps_sigignore, sig)) {
mtx_unlock(&ps->ps_mtx);
if (ksi && (ksi->ksi_flags & KSI_INS))
ksiginfo_tryfree(ksi);
@@ -2144,7 +2143,12 @@
else
intrval = ERESTART;
mtx_unlock(&ps->ps_mtx);
-
+ if (p->p_flag & P_WEXIT) {
+ mtx_lock_spin(&sched_lock);
+ tdsigwakeup(td, sig, action, intrval);
+ mtx_unlock_spin(&sched_lock);
+ return (ret);
+ }
if (prop & SA_CONT)
sigqueue_delete_stopmask_proc(p);
else if (prop & SA_STOP) {
I have a hope that kernel code would wake up and make a progress, while not
actually delivering signal to the user mode handler.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20061022/5e89393b/attachment.pgp
More information about the cvs-src
mailing list