[Bug 849703] Regular Expression matching in signal handler causes side-effects

bugzilla at redhat.com bugzilla at redhat.com
Fri May 10 11:14:21 UTC 2013


Product: Fedora
https://bugzilla.redhat.com/show_bug.cgi?id=849703

--- Comment #6 from Petr Pisar <ppisar at redhat.com> ---
Upstream has merged promising patch:

commit 47c9d59fcd27684d94480b806b8b6e001aac91cc
Author: Nicholas Clark <nick at ccl4.org>
Date:   Sat Apr 14 15:51:33 2012 +0200

    Remove PERL_ASYNC_CHECK() from Perl_leave_scope().

    PERL_ASYNC_CHECK() was added to Perl_leave_scope() as part of commit
    f410a2119920dd04, which moved signal dispatch from the runloop to
    control flow ops, to mitigate nearly all of the speed cost of safe
    signals.

    The assumption was that scope exit was a safe place to dispatch signals.
    However, this is not true, as parts of the regex engine call
    leave_scope(), the regex engine stores some state in per-interpreter
    variables, and code called within signal handlers can change these
    values.

    Hence remove the call to PERL_ASYNC_CHECK() from Perl_leave_scope(), and
    add it explicitly in the various OPs which were relying on their call to
    leave_scope() to dispatch any pending signals. Also add a
    PERL_ASYNC_CHECK() to the exit of the runloop, which ensures signals
    still dispatch from S_sortcv() and S_sortcv_stacked(), as well as
    addressing one of the concerns in the commit message of
    f410a2119920dd04:

        Subtle bugs might remain - there might be constructions that enter
        the runloop (where signals used to be dispatched) but don't contain
        any PERL_ASYNC_CHECK() calls themselves.

    Finally, move the PERL_ASYNC_CHECK(); added by that commit to pp_goto to
    the end of the function, to be consistent with the positioning of all
    other PERL_ASYNC_CHECK() calls - at the beginning or end of OP
    functions, hence just before the return to or just after the call from
    the runloop, and hence effectively at the same point as the previous
    location of PERL_ASYNC_CHECK() in the runloop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=tCuDiyRGYT&a=cc_unsubscribe



More information about the perl-devel mailing list