develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #119993] segmentation fault/memory corruption in pure perl

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
October 1, 2013 02:02
Subject:
[perl #119993] segmentation fault/memory corruption in pure perl
Message ID:
rt-3.6.HEAD-31239-1380592946-1004.119993-15-0@perl.org
On Sat Sep 28 15:39:15 2013, plokinom@gmail.com wrote:
> On 28.09.2013 19:05, Father Chrysostomos via RT wrote:
> > 
> > More random guessing:
> > 
> > Is constant folding causing the stack to be reallocated when coresubs
> > are vivified?  Does PUSHSTACKi/POPSTACK in gv.c:S_maybe_add_coresub make
> > the problem go away?
> 
> I wasn't sure what you meant by that so I did this:
> 
> diff --git a/gv.c b/gv.c
> index 9f0b57e..baf2ea7 100644
> --- a/gv.c
> +++ b/gv.c
> @@ -536,6 +536,8 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
>  #ifdef DEBUGGING
>          CV *orig_cv = cv;
>  #endif
> +        dSP;
> +        PUSHSTACK;
>  	CvLVALUE_on(cv);
>          /* newATTRSUB will free the CV and return NULL if we're still
>             compiling after a syntax error */
> @@ -555,6 +557,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
>                  && opnum != OP_UNDEF)
>                  CvLVALUE_off(cv); /* Now *that* was a neat trick. */
>          }
> +        POPSTACK;
>  	LEAVE;
>  	PL_parser = oldparser;
>  	PL_curcop = oldcurcop;
> 
> 
> Not only does this compile, it also seems to fix the problem: No more
> panics or segfaults.
> 


In order to move the discussion forward, I created a branch, manually
made the changes indicated, tested it (PASS) and pushed it to the
following smoke branch:

smoke-me/jkeenan/119993-gv-c

Since the area being patched is outside of my expertise, I myself take
no position on whether the patch should be merged to blead.

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119993

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