develooper Front page | perl.perl5.porters | Postings from February 2011

Re: [perl #82040] %SIG handlers BLOCK/UNBLOCK signals rather thanBLOCK+save / restore

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
February 12, 2011 13:22
Subject:
Re: [perl #82040] %SIG handlers BLOCK/UNBLOCK signals rather thanBLOCK+save / restore
Message ID:
AANLkTi=3fKNWR+pLk5kJyfQxbbFELQ+Bh+odUQ-V6JKQ@mail.gmail.com
On Tue, Jan 25, 2011 at 11:11 PM, Leon Timmermans <fawaka@gmail.com> wrote:
> ribasushi discovered an issue in this patch. It breaks unsafe signal
> handling. The summary:
>
> When an exception is thrown in a signal handler that results in a call
> to longjmp. Calling longjmp from a signal handler is undefined per C
> standard and POSIX (and has a CERT recommendation against it,
> SIG32-C). On Linux, and probably other systems too, one of the
> consequences of jumping out of a a signal handler is that the signal
> mask won't get reset as it should. The previous code compensated for
> that by always unblocking the signal. Since we can't retroactively
> forbid exceptions in unsafe signal handlers, we should solve this
> differently. We can either
>
> a) Reinstate the old unblocking code for unsafe signals
> b) Don't block the current signal in the first place, by using the
> SA_NODEFER flag in sigaction.

Patch doing option a attached. Not extensively tested though.

Leon


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About