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

Re: When is PL_curcop NULL?

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
September 20, 2013 09:13
Subject:
Re: When is PL_curcop NULL?
Message ID:
20130920091321.4576.qmail@lists-nntp.develooper.com
Nicholas Clark wrote:
> On Tue, Aug 06, 2013 at 01:11:56PM -0000, Father Chrysostomos wrote:
> > I tried adding that block locally and *also* adding assert(PL_curcop)
> > to newGP, and got no failures.  I think that both are a good idea.  We
> > have many months before the next stable release and plenty of time to
> > smoke out places where that assertion is wrong.  (And we will leave
> > the null checks in newGP for now anyway, so non-debugging builds are
> > not sabotaged.)

I implemented that in commit f5d98eaa982e2.  It turns out to be work-
ing so far, because DBIx::Class is failing that assertion.  I have
reduced it to:

INIT {
  eval { eval { sub { die bless {} }->() } }
    or exit;
}

but I have not looked any further yet.
 
> I even tried this, to make a flag that the tokenizer would check, so that it
> would abort if it ever re-instated a freed COP to curcop, and all tests pass.
> (Yes, I realise that this is attempting a read from freed memory, so it's not
> perfect, and I didn't run it under ASAN, as the flat is too hot already,
> without turning that machine on and giving it a serious workout)
> 
> diff --git a/op.c b/op.c
> index d87396b..08c4908 100644
> --- a/op.c
> +++ b/op.c
> @@ -217,6 +217,7 @@ Perl_Slab_Alloc(pTHX_ size_t sz)
>             slot->opslot_next = slab2->opslab_first;    \
>             slab2->opslab_first = slot;                 \
>             o = &slot->opslot_op;                       \
> +           o->op_freed = 0; \
>             o->op_slabbed = 1

o->op_type == OP_FREED would have been enough.


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