Date: Fri, 22 Jun 2007 12:14:21 -0400 From: John Baldwin <jhb@freebsd.org> To: David Xu <davidxu@freebsd.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern kern_sig.c Message-ID: <200706221214.23776.jhb@freebsd.org> In-Reply-To: <4678D5BF.9020609@freebsd.org> References: <200506060513.j565DCur032340@repoman.freebsd.org> <200706192026.41638.jhb@freebsd.org> <4678D5BF.9020609@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 20 June 2007 03:22:39 am David Xu wrote: > John Baldwin wrote: > > On Monday 06 June 2005 01:13:11 am David Xu wrote: > > > >>davidxu 2005-06-06 05:13:11 UTC > >> > >> FreeBSD src repository > >> > >> Modified files: > >> sys/kern kern_sig.c > >> Log: > >> Fix a bug relavant to debugging, a masked signal unexpectedly interrupts > >> a sleeping thread when process is being debugged. > >> > >> PR: GNU/77818 > >> Tested by: Sean C. Farley <sean-freebsd at farley org> > > > > > > This actually breaks other debugging as now debuggers or other processes using > > procfs/ptrace to catch signals can no longer see ignored signals or > > SIGSTOP/SIGCONT. The latter breaks strace when execing a new child process > > as it opens a race where the child process hangs because the parent doesn't > > ever see that the child process has stopped itself with SIGSTOP (the parent > > resumes it with SIGCONT when it sees that). The signal shouldn't make it to > > the target thread if it is ignored, but the process should be stopped and the > > debugger notified of all signals. > > > > Where can you find the place SIGSTOP can be masked or ignored ? > Though SIGCONT can be ignored but it still can resume a suspended > process. if ignored signals can be seen by debugger, then a sleep(10) > will be interrupted by ignored signals when the process is being > debugged, but will work correctly if it is not being debugged, this > becauses issignal() must be called by debugged thread to report any > signals to debugger, the thread should be woken up. I added a printf to stopevent() for S_SIG and it wasn't invoked for SIGSTOP, so PIOCSTATUS ioctl via procfs never returns a status saying the process is stopped on SIGSTOP. Rather than try to untangle the mess that is the signal code I just patched strace to use the same algo truss does for exec'ing a new child process. 4.x worked fine though both for gdb and the existing strace algo, so 6.x as it currently stands is a regression. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706221214.23776.jhb>