Subject: gdb can crash my system (lwp related)
To: None <tech-kern@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 02/05/2003 22:29:57
This is a multipart MIME message.
--==_Exmh_3404328755100
Content-Type: text/plain; charset=us-ascii
Hi -
I'l append a program which panics the system if executed in the
debugger.
Just run it, and type 'c' or 'q' after the signal is reported:
(gdb) r
Starting program: /home/drochner/ccbug/./a.out
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGUSR1, User defined signal 1.
0x4807709f in _sys___sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
The reason is obvious: sys_ptrace() calls proc_unstop() and passes
the result to setrunnable(). And with the process waiting in
sigsuspend() (ie wchan != 0) a NULL gets passed.
The obvious fix, checking proc_unstop()'s result, avoids the panic,
but is not really satisfying because the signal doesn't get
delivered either.
The semantics behind proc_unstop() is not easy to understand...
best regards
Matthias
--==_Exmh_3404328755100
Content-Type: text/plain ; name="sigtest.c"; charset=us-ascii
Content-Description: sigtest.c
Content-Disposition: attachment; filename="sigtest.c"
#include <signal.h>
main()
{
sigset_t ss, ss2;
sigemptyset(&ss);
sigemptyset(&ss2);
sigaddset(&ss, SIGUSR1);
sigprocmask(SIG_SETMASK, &ss, 0);
kill(getpid(), SIGUSR1);
sigsuspend(&ss2);
}
--==_Exmh_3404328755100--