Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/regress/lib/libc/siginfo/sigfpe



christos%astron.com@localhost said:
> These are contradictions and defects in the current standard:
>     http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1318.htm 

Uhm - committees...
As I see it there are two issues mixed:
(a) whether longjmp from (non-nested) signal handlers generally
    works and leads to defined results, and
(b) whether it is a good idea to do it, considering that every
    function which is called while a setjmp() is active, and
    the signal in question is not masked, and which can also
    be called after the longjmp() from the signal handler
    needs to be reentrant

> https://www.securecoding.cert.org/confluence/display/seccode/SIG32-C.+Do+not+call+lo
> ngjmp%28%29+from+inside+a+signal+handler

That's arguably a tricky one but at the end it is just a programmer
error because log_message() is not reentrant.
It also suggests to answer (b) with "no" in most cases -- unless
the window where setjmp() is active and the signal in question
is not masked is well controlled.

I'd still answer (a) with "yes" - this is just a technical problem,
and I thing we do that well (unless an old "sigcontext" signal
trampoline gets in the way).
I'd even say the a longjmp is the only way (besides termination)
to recover halfway sanely from a SIGFPE. Who knows what is left in
floating point registers in that case which might trap on next
access, and even if it doesn't trap the results would be unreliable.
(And imprecise signal delivery makes it worse. I'm not saying that
imprecise signal delivery is necessarily a bad thing, and I don't
understand why -mieeefp if forced on alpha code everywhere, but this
is another matter.)

best regards
Matthias




-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index