develooper Front page | perl.perl5.porters | Postings from March 2017

Re: [perl #131046] [PATCH] Carp: Do not crash when reading @DB::args

Thread Previous
From:
pali
Date:
March 27, 2017 08:30
Subject:
Re: [perl #131046] [PATCH] Carp: Do not crash when reading @DB::args
Message ID:
20170327082957.GA12659@pali
On Saturday 25 March 2017 14:40:18 Zefram via RT wrote:
> via RT wrote:
> >This patch safely iterates all elements of @DB::args array
> 
> It's not safe.  The underlying problem is stack refcounting, leading to
> @DB::args pointing into freed memory.  Interpreting freed memory as SV
> structures fundamentally cannot be made safe.  A patch like this would
> avoid crashing in a few specific cases, where you're lucky enough that
> the freed memory is still recognisable as freed, but this is neither
> necessary nor sufficient in order to avoid crashing.
> 
> This manifestation of the stack refcounting problem can only be solved
> by actually fixing stack refcounting.  In the meantime I'm disinclined
> to apply any such inadequate bandaid.
> 
> -zefram

This patch is fixing problem with Carp when it dies with error "Bizarre
copy". I know that problem is with refcounting perl stack. But in case
Carp dies, and does not crash perl interpreter *before* throwing that
error, that such operation was safe and could be handled by eval. In
case reading that free memory cause SEGFAULT of perl process then it
would be before "Bizarre copy" and this patch have no effect on it.

Working Carp module is crucial for debugging and reporting errors. So it
should be fixed to those problems, specially when it dies in Makefile.PL
or any other critical part...

Thread Previous


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