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

[perl #126240] "panic: free from wrong pool" while freeing the envafter fork on darwin

Thread Previous
From:
Tony Cook via RT
Date:
December 16, 2015 03:53
Subject:
[perl #126240] "panic: free from wrong pool" while freeing the envafter fork on darwin
Message ID:
rt-4.0.18-29642-1450237989-1394.126240-15-0@perl.org
On Wed Dec 09 07:08:21 2015, davem wrote:
> On Tue, Dec 08, 2015 at 03:38:02PM -0800, Tony Cook via RT wrote:
> > I suspect that we should be using -DPERL_USE_SAFE_PUTENV on any
> > system we can
> 
> By "can", do you mean any system that physically works with
> PERL_USE_SAFE_PUTENV, or any system that doesn't leak with
> PERL_USE_SAFE_PUTENV?

I guess that's the hard bit to define.

I'm guessing any system that has unsetenv() will be safe, since setenv(), getenv() and unsetenv() *should* be working together to manage memory correctly.

putenv()'s memory handling isn't well defined in POSIX, ie. there's no 
assumption in POSIX[1] (nor the man pages for Linux, BSD, OS X that I 
saw) that such memory is allocated with malloc(), so an implementation 
can't really free() it safely.

POSIX also mentions[2] that using putenv() can (theoretically) slow down getenv() if an implementation uses an internal structure to speed up environment variable lookups.

Tony

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/putenv.html
The rationale talks about free() in passing, but there's no requirement

[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html
in the rationale.

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

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