perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Hall <>
Subject Re: mod_perl segfaults, can't start Apache
Date Wed, 27 Jun 2012 22:00:16 GMT
I've been seeing the same problem on Gentoo.  I think this is the same
issue as described at .

When perl is compiled, the optimisation switches in the CFLAGS in
make.conf are used, together with some autodetected ones.  When perl
modules, such as mod_perl, are built later, the CFLAGS from the
currently-installed perl are extracted, and used by themselves,
without the autodetected ones.

In this case, the perl compilation was using my CFLAGS, together with
-D_FILE_OFFSET_BITS=64 (among other things).  But mod_perl (and all
other perl modules written in C) are only picking up the CFLAGS.  This
causes a difference in ABI, and hence the crash.

If I add -D_FILE_OFFSET_BITS=64 to the end of my CFLAGS in make.conf,
and recompile perl, then this define still gets added to the compiler
switches -- where it does no harm being specified twice.  If I then
recompile mod_perl, this now includes that switch, after which
everything works fine.

I've since created /etc/portage/env/dev-lang/perl with
CFLAGS="$(CFLAGS) -D_FILE_OFFSET_BITS=64" to save having to alter the
make.conf globally.  This approach ought to be sufficient, but I
haven't had chance to test it.

In case it's useful to anyone, here is the stack trace I was getting
before fixing the problem:

# gdb --args apache2 -D DEFAULT_VHOST -D PERL
GNU gdb (Gentoo 7.4.1 p1) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/sbin/apache2...Reading symbols from
(gdb) r
Starting program: /usr/sbin/apache2 -D DEFAULT_VHOST -D PERL
warning: Could not load shared library symbols for
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/".

Program received signal SIGSEGV, Segmentation fault.
0xb7f0f174 in modperl_env_clear (my_perl=0x8227330) at modperl_env.c:100
100         HV *hv = ENVHV;
(gdb) where
#0  0xb7f0f174 in modperl_env_clear (my_perl=0x8227330) at modperl_env.c:100
#1  0xb7efcfea in modperl_boot (my_perl=0x8227330, data=0x0) at mod_perl.c:100
#2  0xb7e01681 in Perl_leave_scope (my_perl=0x8227330, base=0) at scope.c:970
#3  0xb7e024f3 in Perl_pop_scope (my_perl=0x8227330) at scope.c:110
#4  0xb7d5714b in S_parse_body (xsinit=0xb7efcf70 <modperl_xs_init>,
env=0x0, my_perl=0x8227330) at perl.c:2270
#5  perl_parse (my_perl=0x8227330, xsinit=0xb7efcf70
<modperl_xs_init>, argc=2, argv=0x81862d0, env=0x0) at perl.c:1633
#6  0xb7efd3a6 in modperl_startup (s=0x80b9c08, p=0x80b40a8) at mod_perl.c:255
#7  0xb7efd31c in modperl_startup (s=0x80b9c08, p=0x80b40a8) at mod_perl.c:207
#8  0xb7efd856 in modperl_init (base_server=0x80b9c08, p=0x80b40a8) at
#9  0xb7efda0e in modperl_hook_init (s=0x80b9c08, pconf=0x80b40a8,
plog=<optimized out>, ptemp=<optimized out>) at mod_perl.c:631
#10 modperl_hook_init (pconf=0x80b40a8, plog=0x80e2160,
ptemp=0x80e4168, s=0x80b9c08) at mod_perl.c:608
#11 0x0807d589 in ap_run_open_logs (pconf=0x80b40a8, plog=0x80e2160,
ptemp=0x80e4168, s=0x80b9c08) at config.c:151
#12 0x080680d3 in main (argc=5, argv=0xbfffe3e4) at main.c:680
(gdb) list
95          }
96      }
98      void modperl_env_clear(pTHX)
99      {
100         HV *hv = ENVHV;
101         U32 mg_flags;
103         modperl_env_untie(mg_flags);
(gdb) disassemble
Dump of assembler code for function modperl_env_clear:
   0xb7f0f150 <+0>:     sub    $0x1c,%esp
   0xb7f0f153 <+3>:     mov    %esi,0x14(%esp)
   0xb7f0f157 <+7>:     mov    0x20(%esp),%esi
   0xb7f0f15b <+11>:    mov    %ebx,0x10(%esp)
   0xb7f0f15f <+15>:    call   0xb7efc977 <__i686.get_pc_thunk.bx>
   0xb7f0f164 <+20>:    add    $0x17e90,%ebx
   0xb7f0f16a <+26>:    mov    %edi,0x18(%esp)
   0xb7f0f16e <+30>:    mov    0x2ec(%esi),%eax
=> 0xb7f0f174 <+36>:    mov    0xc(%eax),%eax
   0xb7f0f177 <+39>:    mov    0x14(%eax),%eax
   0xb7f0f17a <+42>:    mov    0x8(%eax),%edi
   0xb7f0f17d <+45>:    mov    %edi,%edx
   0xb7f0f17f <+47>:    and    $0xe00000,%edi
   0xb7f0f185 <+53>:    and    $0xff1fffff,%edx
   0xb7f0f18b <+59>:    mov    %edx,0x8(%eax)
   0xb7f0f18e <+62>:    mov    %eax,0x4(%esp)
   0xb7f0f192 <+66>:    mov    %esi,(%esp)
   0xb7f0f195 <+69>:    call   0xb7efc3d0 <Perl_hv_clear@plt>
   0xb7f0f19a <+74>:    mov    0x2ec(%esi),%eax
   0xb7f0f1a0 <+80>:    mov    0xc(%eax),%eax
   0xb7f0f1a3 <+83>:    mov    0x14(%eax),%eax
   0xb7f0f1a6 <+86>:    or     %edi,0x8(%eax)
   0xb7f0f1a9 <+89>:    mov    0x10(%esp),%ebx
   0xb7f0f1ad <+93>:    mov    0x14(%esp),%esi
   0xb7f0f1b1 <+97>:    mov    0x18(%esp),%edi
   0xb7f0f1b5 <+101>:   add    $0x1c,%esp
   0xb7f0f1b8 <+104>:   ret
End of assembler dump.
(gdb) info registers
eax            0x0      0
ecx            0x0      0
edx            0x822ed28        136506664
ebx            0xb7f26ff4       -1208848396
esp            0xbfffde40       0xbfffde40
ebp            0x80b9c08        0x80b9c08
esi            0x8227330        136475440
edi            0x80b40a8        134955176
eip            0xb7f0f174       0xb7f0f174 <modperl_env_clear+36>
eflags         0x10282  [ SF IF RF ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
(gdb) c

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) q

View raw message