Date: Thu, 20 Feb 2003 12:10:27 +0100 From: Sebastian Lederer <sl@linast.de> To: Wes Peters <wes@softweyr.com> Cc: V.Haisman@sh.cvut.cz, freebsd-hackers@freebsd.org Subject: Re: Raising SIGSEGV in SIGSEGV handler makes FreeBSD loop Message-ID: <20030220121027.31d74d3f.sl@linast.de> In-Reply-To: <200302190851.23498.wes@softweyr.com> References: <20030219134131.T70370-100000@logout.sh.cvut.cz> <200302190851.23498.wes@softweyr.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 19 Feb 2003 08:51:23 -0800 Wes Peters <wes@softweyr.com> wrote: > On Wednesday 19 February 2003 04:43, Vaclav Haisman wrote: [...] > > Besides, this doesn't explain anything. I see I haven't asked any > > question in my previous post. So, why does FreeBSD behave different? > > Because it *is* different? If you want to catch a signal and be > able to handle it, the other two are wrong, are they not? > [...] I think the real question here is, what happens if a SIGSEGV occurs when SIGSEGV is already blocked (like inside the handler)? See the simple test program below. It seems that on FreeBSD, the process just loops on the faulting instruction, whereas Linux and Solaris kill the process, producing a SIGSEGV exit code. I don't know what the correct behaviour is. It is possible to recover from such a SIGSEGV loop from inside the process, using a timer signal, for example, so you might say it is legal to do this and FreeBSD has the correct behaviour. On the other hand, it's most likely just a badly coded crashed program that would waste all free CPU cycles if not killed right away. - Sebastian Lederer --- #include <signal.h> #include <stdio.h> void crash() { int *p=NULL; *p=0xdead; } int main(int argc, char **argv) { sigset_t set; sigset_t oset; sigemptyset(&set); sigaddset(&set,SIGSEGV); sigprocmask(SIG_SETMASK,&set,&oset); crash(); sigprocmask(SIG_SETMASK,&oset,NULL); return 0; } --- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030220121027.31d74d3f.sl>