You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Yuri Karaban <mo...@dev97.com> on 2014/04/14 14:32:19 UTC

SIGSEGV: PerlLoadModule inside VirtualHost with PerlOptions +Parent

1. Problem Description:

Looks like mod_perl executes PerlLoadModule in a context of parent Perl
interpreter and module body is evaluated in parent Perl, but
Apache2::Module::add is switching the context again and in this context
TestParam module was not defined and gv_stashpv("TestParam", FALSE)
returns NULL (at modperl_module.c:764) and gv_fetchmethod_autoload is
executed with the NULL stash (at modperl_module.c:765).

2. Used Components and their Configuration:

*** mod_perl version 2.000008

*** using /usr/lib64/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/sbin/apxs2
  MP_COMPAT_1X   => 1
  MP_DEBUG       => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_TRACE       => 1
  MP_USE_DSO     => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

 -laprutil-1  -ldb-5.2 -lgdbm  -lexpat -L/var/tmp/portage/dev-libs/apr-util-1.5.3-r1/temp
 -lapr-1 -luuid -lrt -lcrypt  -lpthread -ldl



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:

  Platform:
    osname=linux, osvers=3.13.6-gentoo, archname=x86_64-linux-thread-multi
    uname='linux localhost.localdomain 3.13.6-gentoo #1 smp preempt sat mar 29 21:30:07 eet 2014 x86_64'
    config_args='-des -Duseshrplib -Darchname=x86_64-linux-thread -Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-march=core2 -O2 -pipe -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dinstallprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib64/perl5/5.18.2 -Darchlib=/usr/lib64/perl5/5.18.2/x86_64-linux-thread-multi -Dsitelib=/usr/local/lib64/perl5/5.18.2 -Dsitearch=/usr/local/lib64/perl5/5.18.2/x86_64-linux-thread-multi -Dvendorlib=/usr/lib64/perl5/vendor_perl/5.18.2 -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.18.2 -Dlocincpth=/usr/include  -Dglibpth=/lib64 /usr/lib64  -Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Di_ndbm -Di_gdbm -Di_db -Dusethreads -DDEBUGGING=none -Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0 5.18.1/x86_64-linux-thread-multi 5.18.1  -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File'
    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='x86_64-pc-linux-gnu-gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-march=core2 -O2 -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe'
    ccversion='', gccversion='4.8.2', 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 -lpthread -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.18.so, so=so, useshrplib=true, libperl=libperl.so.5.18.2
    gnulibc_version='2.18'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -march=core2 -O2 -pipe -Wl,-O1 -Wl,--as-needed'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Locally applied patches:
	gentoo/EUMM-RUNPATH - https://bugs.gentoo.org/105054 cpan/ExtUtils-MakeMaker: drop $PORTAGE_TMPDIR from LD_RUN_PATH
	gentoo/EUMM_delete_packlist - Don't install .packlist or perllocal.pod for perl or vendor
	gentoo/config_over - Remove -rpath and append LDFLAGS to lddlflags
	gentoo/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN.
	gentoo/cpanplus_definstalldirs - Configure CPANPLUS to use the site directories by default.
	gentoo/create_libperl_soname - https://bugs.gentoo.org/286840 Set libperl soname
	gentoo/drop_fstack_protector - https://bugs.gentoo.org/348557 Don't force -fstack-protector on everyone.
	gentoo/enc2xs - Tweak enc2xs to follow symlinks and ignore missing @INC directories.
	gentoo/mod_paths - Add /etc/perl to @INC
	gentoo/patchlevel - List packaged patches for perl-5.18.2(#1) in patchlevel.h
	gentoo/aix_soname - aix gcc detection and shared library soname support
	gentoo/opensolars_headers - Add headers for opensolaris
	gentoo/cleanup-paths - Cleanup PATH and shrpenv
	gentoo/usr_local - Remove /usr/local paths
	gentoo/hints_hpux - Fix hpux hints
	gentoo/darwin-cc-ld - https://bugs.gentoo.org/297751 darwin: Use $CC to link
	gentoo/interix - Fix interix hints
	fixes/net_smtp_docs - [rt.cpan.org #36038] Document the Net::SMTP 'Port' option
	debian/cpan-missing-site-dirs - Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent is writable
	fixes/memoize_storable_nstore - [rt.cpan.org #77790] Memoize::Storable: respect 'nstore' option not respected
	fixes/net_ftp_failed_command - [rt.cpan.org #37700] Net::FTP: cope gracefully with a failed command
	fixes/perlbug-patchlist - [3541c11] [perl #118433] Make perlbug look up the list of local patches at run time
	fixes/module_metadata_taint_fix - [bff978f] [rt.cpan.org #88576] untaint version, if needed, in Module::Metadata
	fixes/IPC-SysV-spelling - [rt.cpan.org #86736] Fix spelling of IPC_CREAT in IPC-SysV documentation
  Built under linux
  Compiled at Apr  5 2014 18:55:03
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /etc/perl
    /usr/local/lib64/perl5/5.18.2/x86_64-linux-thread-multi
    /usr/local/lib64/perl5/5.18.2
    /usr/lib64/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi
    /usr/lib64/perl5/vendor_perl/5.18.2
    /usr/local/lib64/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/lib64/perl5/5.18.2/x86_64-linux-thread-multi
    /usr/lib64/perl5/5.18.2
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.63, 3.63
ExtUtils::MakeMaker: 6.66, 6.82
LWP                : 6.05
mod_perl           : -
mod_perl2          : 2.000008


3. This is the core dump trace: (if you get a core dump):

#0  0x00007ffff0dd465a in Perl_gv_fetchmethod_pvn_flags ()
   from /usr/lib64/libperl.so.5.18
#1  0x00007ffff11457af in modperl_module_fetch_method (my_perl=0x7492c0,
    p=0x67e138, modp=0x744d78, method=0x7ffff1154763 "DIR_CREATE")
    at modperl_module.c:765
#2  0x00007ffff11459d6 in modperl_module_add (p=0x67e138, s=0x688418,
    name=0x946eb0 "TestParam", mod_cmds=0x94b830) at modperl_module.c:816
#3  0x00007fffede89101 in mpxs_Apache2__Module_add (my_perl=0x844970,
    package=0x946eb0 "TestParam", cmds=0x94b830)
    at /var/tmp/portage/www-apache/mod_perl-2.0.8/work/mod_perl-2.0.8/xs/Apache2/Module/Apache2__Module.h:90
#4  0x00007fffede895ca in XS_Apache2__Module_add (my_perl=0x844970,
    cv=0x9de6e0) at Module.xs:55
#5  0x00007ffff0e412e6 in Perl_pp_entersub () from /usr/lib64/libperl.so.5.18
#6  0x00007ffff0e39936 in Perl_runops_standard ()
   from /usr/lib64/libperl.so.5.18
#7  0x00007ffff0dcbb4b in Perl_eval_sv () from /usr/lib64/libperl.so.5.18
#8  0x00007ffff11312d3 in modperl_require_module (my_perl=0x844970,
    pv=0x72d730 "TestParam", logfailure=0) at modperl_util.c:30
#9  0x00007ffff11299a0 in modperl_cmd_modules (parms=0x7fffffffdb70,
    mconfig=0x743e78, arg=0x72d730 "TestParam") at modperl_cmd.c:190
#10 0x00007ffff112c131 in modperl_cmd_load_module (parms=0x7fffffffdb70,
    mconfig=0x743e78, arg=0x72d730 "TestParam") at modperl_cmd.c:668
#11 0x0000000000440886 in invoke_cmd (cmd=0x7ffff135d678 <modperl_cmds+760>,
    parms=0x7fffffffdb70, mconfig=0x743e78, args=0x72d730 "TestParam")
    at config.c:757
#12 0x0000000000441bc4 in ap_walk_config_sub (current=0x72d6f0,
    parms=0x7fffffffdb70, section_vector=0x743800) at config.c:1163
#13 0x0000000000441c71 in ap_walk_config (current=0x72d6f0,
    parms=0x7fffffffdb70, section_vector=0x743800) at config.c:1196
#14 0x0000000000435014 in virtualhost_section (cmd=0x7fffffffdb70,
    dummy=0x689b60, arg=0x7430d0 "127.0.0.1:8000") at core.c:2234
#15 0x0000000000440886 in invoke_cmd (cmd=0x460510 <core_cmds+80>,
    parms=0x7fffffffdb70, mconfig=0x689b60, args=0x72d618 "127.0.0.1:8000>")
    at config.c:757
#16 0x0000000000441bc4 in ap_walk_config_sub (current=0x72d5d8,
    parms=0x7fffffffdb70, section_vector=0x689740) at config.c:1163
#17 0x0000000000441c71 in ap_walk_config (current=0x72d5d8,
    parms=0x7fffffffdb70, section_vector=0x689740) at config.c:1196
#18 0x0000000000442fc3 in ap_process_config_tree (s=0x688418,
    conftree=0x6ada78, p=0x67e138, ptemp=0x68a198) at config.c:1765
#19 0x0000000000425252 in main (argc=3, argv=0x7fffffffdda8) at main.c:645

4. This is the Apache config file:

Listen 127.0.0.1:8000

<VirtualHost 127.0.0.1:8000>
	PerlOptions +Parent
	PerlSwitches -I/path/to/module
	PerlLoadModule TestParam

	CustomLog /tmp/access.log combined
	ErrorLog /tmp/error.log
</VirtualHost>

5. This is the Perl module:

package TestParam;

use strict;
use warnings;

use Apache2::Module ();

my @directives = ({ name => 'TestParam' });

Apache2::Module::add(__PACKAGE__, \@directives);

1;

This report was generated by /usr/bin/mp2bug on Mon Apr 14 11:39:36 2014 GMT.

-- 
E pluribus unum