You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Al...@t-systems.com on 2012/02/22 16:13:19 UTC

mod_perl-2.0.5 -- nullpointer patch

Hello,

I got a nullpointer from mod_perl2 on a solaris x86 machine in:

#0  0xfca42b00 in ap_pcw_walk_files_config () from /opt/ae/modules/mod_perl.so
#1  0xfca42c9e in ap_pcw_walk_config () from /opt/ae/modules/mod_perl.so
#2  0xfca4294a in modperl_mgv_hash_handlers () from /opt/ae/modules/mod_perl.so
#3  0xfca39029 in modperl_hook_post_config_last () from /opt/ae/modules/mod_perl.so
#4  0x080a2034 in ap_run_post_config (pconf=0x8215970, plog=0x8253a68, ptemp=0x8255a70, s=0x821f5d0) at config.c:91
#5  0x08091ec2 in main (argc=3, argv=0x8047bfc) at main.c:679


My fix:
cd mod_perl-2.0.5/src/modules/perl
vi modperl_pcw.c # ap_pcw_walk_files_config

    if (0 == dconf->sec_file) { // nullpointer fix
        return;
    }


Now the daemon seems to work, but I do not know, why this happens.


Greetings,
Alexander Elgert

--
Deutsche Telekom AG
Seamless ICT Security Infrastructure & Management
im Auftrag T-Systems International GmbH
Dipl. Inf Alexander Elgert
Langwadener Strasse 17
64625 Bensheim
+49 176 22 717 661 (Mobil)
+49 671 83419-12 (Tel)
+49 671 83419-30 (Fax)
E-Mail: alexander.elgert@gmx.de

Re: AW: mod_perl-2.0.5 -- nullpointer patch

Posted by Torsten Förtsch <to...@gmx.net>.
On Thursday, 23 February 2012 01:39:02 Alexander.Elgert@t-systems.com wrote:
> Hope this was the requested information.

I meant the httpd.conf.

The one thing I noticed at the first glance is that there isn't any modperl 
related directive other than the LoadModule. If nobody beats me to it I'll 
have a closer look after my vacation.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


AW: mod_perl-2.0.5 -- nullpointer patch

Posted by Al...@t-systems.com.
That was just a standard compiled apache, what config file are we talking about? httpd.conf?

a) configure skript
b) httpd -V
c) grep -v '^[ ]*#' httpd.conf | grep -v '^$'| uniq

Thank you.

Greetings,
Alexander

PS: Sorry for TOFU. ;(

a) ============
./configure \
--disable-nls \
--with-apxs2 \
--enable-fastcgi \
--disable-short-tags \
--with-openssl \
--with-zlib \
--with-imap-ssl \
--with-mysql \
--with-mysqli \
--with-pdo-pgsql \
--with-pdo-sqlite \
--with-pgsql \
--with-readline \
--enable-soap \
--enable-sockets \
--enable-sqlite-utf8 \
--enable-zip \
--with-zend-vm \
--enable-static-support \
--enable-static-htpasswd \
--enable-static-rotatelogs \
--enable-static-logresolve \
--enable-static-htdbm \
--enable-static-ab \
--enable-static-checkgid \
--enable-static-htcacheclean \
--enable-static-httxt2dbm \
--enable-ssl \
--with-ssl=/opt/ae

b) ===================
Server version: Apache/2.2.21 (Unix)
Server built:   Oct 28 2011 16:27:44
Server's Module Magic Number: 20051115:30
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_PROC_PTHREAD_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/opt/ae"
 -D SUEXEC_BIN="/opt/ae/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

c) ====================
$ grep -v '^[ ]*#' httpd.conf | grep -v '^$'| uniq
ServerRoot "/opt/ae"
Listen 8080
LoadModule php5_module        modules/libphp5.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
ServerAdmin you@example.com
DocumentRoot "/opt/ae/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
<Directory "/opt/ae/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" common
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/opt/ae/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/opt/ae/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
 LoadModule perl_module modules/mod_perl.so
=======================

Hope this was the requested information.


________________________________________
Von: Torsten Förtsch [torsten.foertsch@gmx.net]
Gesendet: Mittwoch, 22. Februar 2012 19:07
An: modperl@perl.apache.org
Cc: Elgert, Alexander
Betreff: Re: mod_perl-2.0.5 -- nullpointer patch

On Wednesday, 22 February 2012 16:13:19 Alexander.Elgert@t-systems.com wrote:
> My fix:
> cd mod_perl-2.0.5/src/modules/perl
> vi modperl_pcw.c # ap_pcw_walk_files_config
>
>     if (0 == dconf->sec_file) { // nullpointer fix
>         return;
>     }
>
>
> Now the daemon seems to work, but I do not know, why this happens.

I have seen that while working on the 2.4 port of modperl. In the httpd24
branch each of ap_pcw_walk_location_config, ap_pcw_walk_directory_config and
ap_pcw_walk_files_config are instrumented with

  if( !sconf->sec_XXX ) return;

before doing anything (where XXX is one of url, dir or file).

Would be interesting to see the configuration that triggers it. Can you
provide an as much as possible stripped down configuration that exposes the
bug?

Torsten Förtsch

--
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


Re: mod_perl-2.0.5 -- nullpointer patch

Posted by Torsten Förtsch <to...@gmx.net>.
On Wednesday, 22 February 2012 16:13:19 Alexander.Elgert@t-systems.com wrote:
> My fix:
> cd mod_perl-2.0.5/src/modules/perl
> vi modperl_pcw.c # ap_pcw_walk_files_config
> 
>     if (0 == dconf->sec_file) { // nullpointer fix
>         return;
>     }
> 
> 
> Now the daemon seems to work, but I do not know, why this happens.

I have seen that while working on the 2.4 port of modperl. In the httpd24 
branch each of ap_pcw_walk_location_config, ap_pcw_walk_directory_config and 
ap_pcw_walk_files_config are instrumented with

  if( !sconf->sec_XXX ) return;

before doing anything (where XXX is one of url, dir or file).

Would be interesting to see the configuration that triggers it. Can you 
provide an as much as possible stripped down configuration that exposes the 
bug?

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net