You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Bradley Baetz <bb...@student.usyd.edu.au> on 2002/10/15 15:22:52 UTC

[mp2] segfault deleting ENV variable

The following one line script will cause apache/mod_perl2 to segfault:

delete @::ENV{'PATH'};

I've tried this with both apache-2.0.40/mod_perl-1.99_05/perl-5.8.0 (ie
stock RH8), and apache-2.0.43/mod_perl-1.99_07/perl-5.8.0

A backtrace from the later combination gives:

#0  0x4024b447 in Perl_mg_clear ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#1  0x40253989 in Perl_hv_delete_ent ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#2  0x4027ff27 in Perl_pp_delete ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#3  0x40258059 in Perl_runops_standard ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#4  0x40200139 in S_call_body ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#5  0x401ffeb6 in Perl_call_sv ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#6  0x401c85f2 in modperl_callback ()
   from /usr/local/apache2/modules/mod_perl.so
#7  0x401c8abe in modperl_callback_run_handlers ()
   from /usr/local/apache2/modules/mod_perl.so
#8  0x401c8d05 in modperl_callback_per_dir ()
   from /usr/local/apache2/modules/mod_perl.so
#9  0x401c4a55 in modperl_response_handler_run ()
   from /usr/local/apache2/modules/mod_perl.so
#10 0x401c4c75 in modperl_response_handler_cgi ()
   from /usr/local/apache2/modules/mod_perl.so
#11 0x0807c4f0 in ap_run_handler (r=0x8160178) at config.c:195
#12 0x0807cad6 in ap_invoke_handler (r=0x8160178) at config.c:401
#13 0x0806afc7 in ap_process_request (r=0x8160178) at http_request.c:288
#14 0x08066be1 in ap_process_http_connection (c=0x815bd10) at 
http_core.c:293
#15 0x08086268 in ap_run_process_connection (c=0x815bd10) at 
connection.c:85
#16 0x08086555 in ap_process_connection (c=0x815bd10, csd=0x815bc40)
    at connection.c:207
#17 0x0807ae0d in child_main (child_num_arg=1651076143) at prefork.c:696
#18 0x0807afd4 in make_child (s=0x80b9358, slot=0) at prefork.c:736
#19 0x0807b041 in startup_children (number_to_start=5) at prefork.c:808
#20 0x0807b7bf in ap_mpm_run (_pconf=0x80ab53c, plog=0x80eed30, 
s=0x80b9358)
    at prefork.c:1024
#21 0x08080d8e in main (argc=2, argv=0xbffff924) at main.c:643
#22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

I built apache with debug info, but forgot to build mod_perl that way. The 
above one liner script should be enough to reproduce this, though.

This happens in PerlRun or Registry mode. It isn't restricted to the PATH
variable; deleting any existing ENV var causes the crash.

Thanks,

Bradley


Re: [mp2] segfault deleting ENV variable

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Tue, 2002-10-15 at 21:22, Bradley Baetz wrote:
> The following one line script will cause apache/mod_perl2 to segfault:
> 
> delete @::ENV{'PATH'};

$ENV{'PATH'} would be slightly more modern ;-)

> 
> I've tried this with both apache-2.0.40/mod_perl-1.99_05/perl-5.8.0 (ie
> stock RH8), and apache-2.0.43/mod_perl-1.99_07/perl-5.8.0

I just tried with both the configuration you list here, and no
segfaults.

The code I used is this :

{
        my $path = $ENV{'PATH'};
        delete $ENV{'PATH'};
        ok t_cmp($ENV{'PATH'}, undef, "Path deleted");
        $ENV{'PATH'} = $path;
        ok t_cmp($ENV{'PATH'}, $path, "Path set");
}

So, could you please try and recompile mod_perl with debug info and send
both a stack trace and the exact code you are using for your handler ?

Thanks!

> A backtrace from the later combination gives:
> 
> #0  0x4024b447 in Perl_mg_clear ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #1  0x40253989 in Perl_hv_delete_ent ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #2  0x4027ff27 in Perl_pp_delete ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #3  0x40258059 in Perl_runops_standard ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #4  0x40200139 in S_call_body ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #5  0x401ffeb6 in Perl_call_sv ()
>    from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
> #6  0x401c85f2 in modperl_callback ()
>    from /usr/local/apache2/modules/mod_perl.so
> #7  0x401c8abe in modperl_callback_run_handlers ()
>    from /usr/local/apache2/modules/mod_perl.so
> #8  0x401c8d05 in modperl_callback_per_dir ()
>    from /usr/local/apache2/modules/mod_perl.so
> #9  0x401c4a55 in modperl_response_handler_run ()
>    from /usr/local/apache2/modules/mod_perl.so
> #10 0x401c4c75 in modperl_response_handler_cgi ()
>    from /usr/local/apache2/modules/mod_perl.so
> #11 0x0807c4f0 in ap_run_handler (r=0x8160178) at config.c:195
> #12 0x0807cad6 in ap_invoke_handler (r=0x8160178) at config.c:401
> #13 0x0806afc7 in ap_process_request (r=0x8160178) at http_request.c:288
> #14 0x08066be1 in ap_process_http_connection (c=0x815bd10) at 
> http_core.c:293
> #15 0x08086268 in ap_run_process_connection (c=0x815bd10) at 
> connection.c:85
> #16 0x08086555 in ap_process_connection (c=0x815bd10, csd=0x815bc40)
>     at connection.c:207
> #17 0x0807ae0d in child_main (child_num_arg=1651076143) at prefork.c:696
> #18 0x0807afd4 in make_child (s=0x80b9358, slot=0) at prefork.c:736
> #19 0x0807b041 in startup_children (number_to_start=5) at prefork.c:808
> #20 0x0807b7bf in ap_mpm_run (_pconf=0x80ab53c, plog=0x80eed30, 
> s=0x80b9358)
>     at prefork.c:1024
> #21 0x08080d8e in main (argc=2, argv=0xbffff924) at main.c:643
> #22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
> 
> I built apache with debug info, but forgot to build mod_perl that way. The 
> above one liner script should be enough to reproduce this, though.
> 
> This happens in PerlRun or Registry mode. It isn't restricted to the PATH
> variable; deleting any existing ENV var causes the crash.
> 
> Thanks,
> 
> Bradley
> 
>