develooper Front page | perl.perl5.porters | Postings from May 2012

Trouble with XS-APItest/t/clone-with-stack.t

Thread Next
Michael Schroeder
May 25, 2012 08:13
Trouble with XS-APItest/t/clone-with-stack.t
Message ID:

Hi Porters,

I ran into a bit of a problem when building perl-5.16.0.
'make test' showed a segfault in ext/XS-APItest/t/clone-with-stack.t.
It seems to be caused by accessing already freed memory, it
segfaults because I have MALLOC_PERTUBE_ set, thus glibc fills
freed memory with some value.

Digging deeper, it seems like perl_clone() does not fix
the cx's blk_oldcop element when doing context cloning, thus
blk_oldcop still points to the old interp and the POPBLOCK
done in leavesub will copy the data from the old interp to

After fixing this, it still crashed because interp_dup->Iop was
zero after the runops_standard() call (which is probably
correct as the end of the BEGIN block was reached). So I
also added an if statement that checks the pointer.

So, is the attached patch correct or is that a bad way to
fix this problem?


Michael Schroeder                         
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About