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

[perl #99850] Segmentation fault when a destructor kills a sub about to be goto'd into

Thread Next
From:
perl @ profvince . com
Date:
September 23, 2011 09:20
Subject:
[perl #99850] Segmentation fault when a destructor kills a sub about to be goto'd into
Message ID:
rt-3.6.HEAD-31297-1316774425-1588.99850-75-0@perl.org
# New Ticket Created by  perl@profvince.com 
# Please include the string:  [perl #99850]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=99850 >



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


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

The following code:

perl -wle'sub reftype { "whatever" }; sub DESTROY { undef &reftype } 
print sub { my $guard = bless []; goto &reftype }->(\1)'

has been segfaulting since perl 5.8.0. It is not a very smart thing to 
do, but
it can be suprising if the undef is hidden below several abstraction layers.
XSUBs suffer from the same issue, as:

perl -wle'use Scalar::Util qw<reftype>; sub DESTROY { undef &reftype } 
print sub { my $guard = bless []; goto &reftype }->(\1)'

segfaults as well.

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

Configured by Gentoo at Tue Aug  9 15:15:55 CEST 2011.

Summary of my perl5 (revision 5 version 12 subversion 4) configuration:
      Platform:
     osname=linux, osvers=2.6.39.1-fuuka.profvince.com, 
archname=x86_64-linux
     uname='linux fuuka 2.6.39.1-fuuka.profvince.com #1 smp fri jun 10 
20:18:17 cest 2011 x86_64 intel(r) core(tm)2 duo cpu e6750 @ 2.66ghz 
genuineintel gnulinux '
     config_args='-des -Duseshrplib -Darchname=x86_64-linux 
-Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-march=core2 -O3 
-fomit-frame-pointer -ftree-vectorize -ftree-vectorizer-verbose=1 -pipe 
-DNDEBUG -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr 
-Dsiteprefix=/usr -Dvendorprefix=/usr -Dscriptdir=/usr/bin 
-Dprivlib=/usr/lib64/perl5/5.12.4 
-Darchlib=/usr/lib64/perl5/5.12.4/x86_64-linux 
-Dsitelib=/usr/lib64/perl5/site_perl/5.12.4 
-Dsitearch=/usr/lib64/perl5/site_perl/5.12.4/x86_64-linux 
-Dvendorlib=/usr/lib64/perl5/vendor_perl/5.12.4 
-Dvendorarch=/usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux 
-Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 
-Dsiteman1dir=/usr/share/man/man1 -Dsiteman3dir=/usr/share/man/man3 
-Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3 
-Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.12.4 -Dlocincpth= 
-Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost 
-Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm 
-Di_ndbm -Di_gdbm -Di_db -DDEBUGGING=none 
-Dinc_version_list=5.12.3/x86_64-linux 5.12.3 5.12.2/x86_64-linux 5.12.2 
5.12.1/x86_64-linux 5.12.1 5.12.0/x86_64-linux 5.12.0 
-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=undef, usemultiplicity=undef
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=define, use64bitall=define, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='x86_64-pc-linux-gnu-gcc', ccflags ='-fno-strict-aliasing -pipe 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-march=core2 -O3 -fomit-frame-pointer -ftree-vectorize 
-ftree-vectorizer-verbose=1 -pipe -DNDEBUG',
     cppflags='-fno-strict-aliasing -pipe'
     ccversion='', gccversion='4.5.3', 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='x86_64-pc-linux-gnu-gcc', ldflags ='-Wl,-O1 -Wl,--as-needed'
     libpth=/usr/local/lib64 /lib64 /usr/lib64
     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.13.so, so=so, useshrplib=true, 
libperl=libperl.so.5.12.4
     gnulibc_version='2.13'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -march=core2 -O3 
-fomit-frame-pointer -ftree-vectorize -ftree-vectorizer-verbose=1 -pipe 
-DNDEBUG -Wl,-O1 -Wl,--as-needed'

Locally applied patches:
     0001-gentoo_MakeMaker-RUNPATH.diff
     0002-gentoo_config_over.diff
     0003-gentoo_cpan_definstalldirs.diff
     0004-gentoo_cpanplus_definstalldirs.diff
     0005-gentoo_create-libperl-soname.diff
     0006-gentoo_MakeMaker-delete_packlist.diff
     0007-fixes_8d66b3f9_h2hp_fix.diff
     0008-fixes_f178b03b_h2ph_using_deprecated_goto.diff
     0009-gentoo_mod-paths.diff
     0010-gentoo_enc2xs.diff
     0011-gentoo_IO-Compress_AutoLoader_dropped_from_Compress-Zlib.diff
     0012-gentoo_drop-fstack-protector.diff

---
@INC for perl 5.12.4:
     /etc/perl
     /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux
     /usr/lib64/perl5/site_perl/5.12.4
     /usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux
     /usr/lib64/perl5/vendor_perl/5.12.4
     /usr/lib64/perl5/site_perl
     /usr/lib64/perl5/vendor_perl/5.12.3/x86_64-linux
     /usr/lib64/perl5/vendor_perl/5.12.3
     /usr/lib64/perl5/vendor_perl/5.12.2/x86_64-linux
     /usr/lib64/perl5/vendor_perl/5.12.2
     /usr/lib64/perl5/vendor_perl
     /usr/lib64/perl5/5.12.4/x86_64-linux
     /usr/lib64/perl5/5.12.4
     /usr/local/lib/site_perl
     .

---
Environment for perl 5.12.4:
     HOME=/home/vince
     LANG=fr_FR.UTF-8
     LANGUAGE (unset)
     LC_ALL=fr_FR.UTF-8
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/home/vince/bin:/home/vince/perl/builds/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3:/opt/intel/cce/10.1.018/bin:/usr/games/bin
     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