Date: Thu, 13 Mar 2003 03:25:41 +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: <20030313023818.O450@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);
> }
Thanks. At last it is possible to reproduce this bug :-).
The bug seems to be that issignal() is quite broken. It gets called
for masked signals in the P_TRACED case, but never does anything for
masked signals, but at least the following things poing to a need
for doing something for masked signals:
- the special case for P_TRACED in SIGPENDING()
- the incorrect behaviour of the above program in RELENG_4. I think
it misbehaves in the same way under -current except in the INVARIANTS
case the sanity check spews kernel printfs.
- code in NetBSD's issignal() to do something in the (p->p_stat == SSTOP)
case without even checking if there are any signals (masked or not).
This bug seems to go back to at least FreeBSD-1 (Net/2).
SIGPENDING() is also inconsistent with issignal() in the P_PPWAIT case.
I think this just wastes time doing null calls to issignal(), and
triggers the INVARIANTS check in the same way as the P_TRACED case
(see below). This seems to go back to FreeBSD-1 too.
SIGPENDING() is consistent with issignal() in the S_SIG case, but this
may be wrong since S_SIG is similar to P_TRACED.
The invariants check gets trigger as follows:
- sigpending() is called correctly.
- ast() clears the flags set by sigpending() and "handles" the signal
using "while ((sig == cursig(td)) != 0) postsig()". But cursig()
doesn't find any signals since all the pending ones are masked.
- userret() checks that pending signals were handled. It finds
unhandled masked ones and thinks they needed handling because
P_TRACED is set.
(IIRC, there is only a SIGTRAP pending to begin with, but attempting
to control the process using ^C^Z gave masked SIGINTs and SIGSTOPs
too).
Appart from the diagnostic, the incorrect working in -current is to
loop endlessly calling ast() and usrret(). ^C^Z doesn't stop it
because they are masked.
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?20030313023818.O450>
