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

[perl #77372] Deleting non-existent values from %ENV causes segfault when compiled with PERL_USE_SAFE_PUTENV

Thread Next
From:
chrishammond @ ymail . com
Date:
August 23, 2010 05:03
Subject:
[perl #77372] Deleting non-existent values from %ENV causes segfault when compiled with PERL_USE_SAFE_PUTENV
Message ID:
rt-3.6.HEAD-5116-1282554501-742.77372-75-0@perl.org
# New Ticket Created by  chrishammond@ymail.com 
# Please include the string:  [perl #77372]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77372 >



This is a bug report for perl from chrishammond@ymail.com,
generated with the help of perlbug 1.39 running under perl 5.12.1.


-----------------------------------------------------------------
[Please describe your issue here]

Hi,

I've got an instance of Perl 5.12.1 which has been compiled using the PERL_USE_SAFE_PUTENV flag defined, and have noted that it segfaults if you try to clear a non-existent value from the magic %ENV hash if local'ed.


Using 5.12.1 compiled with with:
config_args="-Accflags=-DPERL_USE_SAFE_PUTENV"


perl -e "local %ENV;delete $ENV{q{UNDEFINED}}"
or
DEFINED=YES perl -e "local %ENV;delete $ENV{q{DEFINED}}"

Segmentation fault (core dumped)

Process terminating with default action of signal 11 (SIGSEGV): dumping core

Invalid read of size 8
unsetenv (setenv.c:295)
by Perl_magic_clearenv




No seg fault from:

DEFINED=YES perl -e "delete local $ENV{q{DEFINED}}"
or
perl -e "delete local $ENV{q{UNDEFINED}}"
or
DEFINED=YES perl -e "local %ENV=%ENV;delete $ENV{q{DEFINED}}"
or
perl -e "local %ENV=%ENV;delete $ENV{q{UNDEFINED}}"



Some code that does this:
Math::Pari utils/Math/PariBuild.pm
Some code that did this:
Google-Chart 0.05014 t/90_env_proxy.t


Thanks,

Chris

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.12.1:

Configured by pmbuild at Wed Aug 18 04:31:57 EDT 2010.

Summary of my perl5 (revision 5 version 12 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=2.6.18-194.3.1.el5, archname=x86_64-linux-thread-multi
    uname='linux ngbuilda01 2.6.18-194.3.1.el5 #1 smp sun may 2 04:17:42 edt 2010 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dprefix=/home/chammond/perl -Duseshrplib -Dusethreads -Accflags=-DPERL_USE_SAFE_PUTENV'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2 20081105 (Red Hat 4.3.2-14)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/chammond/perl/lib/5.12.1/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.12.1:
    /home/chammond/perl/lib/site_perl/5.12.1/x86_64-linux-thread-multi
    /home/chammond/perl/lib/site_perl/5.12.1
    /home/chammond/perl/lib/5.12.1/x86_64-linux-thread-multi
    /home/chammond/perl/lib/5.12.1
    .

---
Environment for perl 5.12.1:
    HOME=/home/chammond
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/chammond/perl/bin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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