Date: Fri, 14 Mar 2003 06:46:27 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Tim Robbins <tjr@FreeBSD.ORG> Cc: current@FreeBSD.ORG Subject: Re: failed to set signal flags properly for ast() Message-ID: <20030314061240.L817@gamplex.bde.org> In-Reply-To: <20030312141804.A12375@dilbert.robbins.dropbear.id.au> References: <20030312141804.A12375@dilbert.robbins.dropbear.id.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 Mar 2003, Tim Robbins wrote: > Compile, run under gdb, then type "print test()" when the program receives > SIGABRT. Seems to work incorrectly on 4.7 too. > > #include <stdio.h> > #include <stdlib.h> > > void > test(void) > { > > puts("hello"); > } > > int > main(int argc, char *argv[]) > { > > abort(); > exit(0); > } Here's a simpler example: %%% #include <signal.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { sigset_t mask, omask; volatile int i; sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &omask); exit(0); } %%% Single stepping through this hangs at the end of the sigprocmask() and triggers the INVARIANTS check. This is because masking SIGTRAP fouls up trap handling. I first tried masking only SIGTRAP. This caused a SIGSEGV on return of sigprocmask(). Masking SIGSEGV as well stops gdb seeing any signals. abort() causes similar misbehaviour by masking almost all signals. gdb gets control for SIGABRT because SIGABRT is not masked, but "call test()" hangs because it generates a SIGTRAP but SIGTRAP is masked. The system states are approx. 10% user and 90% sys for the hang in both cases, so it seems that the misbehaviour is just the usual one for bogusly masking signals for restartable exceptions if such an exception occurs, and the bug is mainly in the sanity check (SIGPENDING()'s P_TRACED check is less than a pessimization). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030314061240.L817>