This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make XS::APItest::establish_cleanup protect existing stacks
authorFather Chrysostomos <sprout@cpan.org>
Mon, 6 Jan 2014 00:09:35 +0000 (16:09 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 17 Jan 2014 01:58:37 +0000 (17:58 -0800)
commita59fa18fc69fd714097da0fbefe02d42727641f6
tree88f54dfa4b234f3a508a065da633c5cfb1893fd6
parentb001a0d149ed99df18916796f3a72b2c888b94d8
Make XS::APItest::establish_cleanup protect existing stacks

It causes pp_entersub to be called in odd places, which can cause the
context stack to be reallocated when an outer function call (like
pp_leavesub) has a pointer into the context stack in a C auto.

cleanup.t was failing for me under PERL_DEBUG_READONLY_COW +
STRESS_REALLOC + threads, because the context stack was reallocated
and the old address then freed and reused for something else, being
zeroed in the mean time.  So pp_leavesub returned NULL (trying to
read retop from the context stack), causing the program to exit.
During global destruction, subs that had not be exited properly were
undefined, leading to:

1..3
Can't undef active subroutine during global destruction.
ext/XS-APItest/APItest.xs