develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #35925] GvHV() can end up pointing at garbage - thread dup bug

From:
Father Chrysostomos via RT
Date:
December 5, 2010 17:26
Subject:
[perl #35925] GvHV() can end up pointing at garbage - thread dup bug
Message ID:
rt-3.6.HEAD-13564-1291598813-1800.35925-15-0@perl.org
On Sat May 21 09:25:10 2005, nicholas wrote:
> There is a bug in duping - GvHV() can end up pointing at garbage.
> 
> If I add this assertion to gv.c (*without* my recent HV changes, so
>    this
> bug predates them):
> 
> --- gv.c.orig   Sat May 21 04:25:40 2005
> +++ gv.c        Sat May 21 13:44:49 2005
> @@ -1304,7 +1304,12 @@ Perl_gp_free(pTHX_ GV *gv)
> 
>      if (gp->gp_sv) SvREFCNT_dec(gp->gp_sv);
>      if (gp->gp_av) SvREFCNT_dec(gp->gp_av);
> +    /* FIXME - another reference loop GV -> symtab -> GV ?
> +       Somehow gp->gp_hv can end up pointing at freed garbage.  */
>      if (gp->gp_hv) {
> +       if (SvTYPE(gp->gp_hv) != SVTYPEMASK) {
> +           assert(SvTYPE(gp->gp_hv) == SVt_PVHV);
> +       }
>          if (PL_stashcache && HvNAME(gp->gp_hv))
>               hv_delete(PL_stashcache,
>                         HvNAME(gp->gp_hv), strlen(HvNAME(gp->gp_hv)),
> 
> 
> then various thread-creating tests fail during global destruction:

Since :unique has been made a no-op, this can’t happen any more, so I’m
marking this as resolved. If I’m wrong, somebody please re-open it.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About