Date: Tue, 31 Aug 2010 05:30:06 GMT From: David Xu <davidxu@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/150138: [patch] signal sent to stopped, traced process not immediately handled on continue Message-ID: <201008310530.o7V5U65M007254@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/150138; it has been noted by GNATS. From: David Xu <davidxu@freebsd.org> To: Dan McNulty <dkmcnulty@gmail.com> Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: kern/150138: [patch] signal sent to stopped, traced process not immediately handled on continue Date: Tue, 31 Aug 2010 13:27:01 +0000 Dan McNulty wrote: > On Tue, Aug 31, 2010 at 6:09 AM, David Xu <davidxu@freebsd.org> wrote: >> User & wrote: >> >>>> Fix: >>> The attached patch ( to CURRENT ) takes a stab at fixing the problem. The >>> patch >>> adds code so that even if the process is being traced, a signal sent to a >>> interruptibly sleeping thread wakes up the thread so it will handle the >>> signal >>> when the process leaves the stopped state. The added code was copied from >>> the >>> code that handled stopped, non-traced processes later in the same >>> function. >> No patch ? >> > > Sorry, in trying to figure out send-pr, didn't actually attach the > patch and other files. > > They should be attached now. > I also propose a new patch, it seems if the process is being traced, we should hand off job control to debugger, all job control caused by STOP/CONT signals should be skipped, but normal signal should remove thread from sleep queue. Index: kern_sig.c =================================================================== --- kern_sig.c (版本 211859) +++ kern_sig.c (工作副本) @@ -2139,20 +2139,9 @@ * We try do the per-process part here. */ if (P_SHOULDSTOP(p)) { - /* - * The process is in stopped mode. All the threads should be - * either winding down or already on the suspended queue. - */ - if (p->p_flag & P_TRACED) { - /* - * The traced process is already stopped, - * so no further action is necessary. - * No signal can restart us. - */ - goto out; - } - if (sig == SIGKILL) { + if (p->p_flag & P_TRACED) + goto out; /* * SIGKILL sets process running. * It will die elsewhere. @@ -2163,6 +2152,8 @@ } if (prop & SA_CONT) { + if (p->p_flag & P_TRACED) + goto out; /* * If SIGCONT is default (or ignored), we continue the * process but don't leave the signal in sigqueue as @@ -2207,6 +2198,8 @@ } if (prop & SA_STOP) { + if (p->p_flag & P_TRACED) + goto out; /* * Already stopped, don't need to stop again * (If we did the shell could get confused).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008310530.o7V5U65M007254>