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

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

Thread Next
From:
Michael Schroeder
Date:
May 25, 2012 08:13
Subject:
Trouble with XS-APItest/t/clone-with-stack.t
Message ID:
20120525151310.GA23148@suse.de

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
PL_curcop.

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?

Cheers,
  Michael.

-- 
Michael Schroeder                                   mls@suse.de
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}

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