From owner-freebsd-current Thu Mar 13 11:46:35 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65FBA37B401; Thu, 13 Mar 2003 11:46:33 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 938A443F3F; Thu, 13 Mar 2003 11:46:31 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id GAA05092; Fri, 14 Mar 2003 06:46:28 +1100 Date: Fri, 14 Mar 2003 06:46:27 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Tim Robbins Cc: current@FreeBSD.ORG Subject: Re: failed to set signal flags properly for ast() In-Reply-To: <20030312141804.A12375@dilbert.robbins.dropbear.id.au> Message-ID: <20030314061240.L817@gamplex.bde.org> References: <20030312141804.A12375@dilbert.robbins.dropbear.id.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 > #include > > void > test(void) > { > > puts("hello"); > } > > int > main(int argc, char *argv[]) > { > > abort(); > exit(0); > } Here's a simpler example: %%% #include #include #include 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