php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40019 PHP 5.2.0 on Solaris causes Apache to Segfault (when compiled with GCC 4.0.3)
Submitted: 2007-01-04 08:18 UTC Modified: 2007-01-05 07:34 UTC
From: deepblue2007 at bluewin dot ch Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.0 OS: Solaris 9 and 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: deepblue2007 at bluewin dot ch
New email:
PHP Version: OS:

 

 [2007-01-04 08:18 UTC] deepblue2007 at bluewin dot ch
Description:
------------
PHP 5.2.0 compiled for Apache 2.2.3 on Solaris 10 or 9 causes to segmentation fault. I experienced this problem while installing Squirrelmail 1.4.9a. PHP was compiled on a Solaris 9 system using gcc 4.0.3. I'll try to generate a core file and send it.


PHP Code Example
----------------

print "Hello World";               --> works
phpinfo();                         --> works
header('Location: src/login.php'); --> segfault



Apache error_log
----------------
[notice] child pid 9278 exit signal Segmentation fault (11)



Apache truss
------------
9219:   open("/opt/adnwebmail/squirrelmail/index.php", O_RDONLY) = 16
9219:   fstat(16, 0x002D50C8)                           = 0
9219:   lseek(16, 0, SEEK_CUR)                          = 0
9219:   read(16, " < ? p h p\n\n / * *\n  ".., 8192)    = 691
9219:   read(16, 0x002D6B30, 8192)                      = 0
9219:   read(16, 0x002D6B30, 8192)                      = 0
9219:   close(16)                                       = 0
9219:       Incurred fault #6, FLTBOUNDS  %pc = 0xFDEB6118
9219:         siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
9219:       Received signal #11, SIGSEGV [caught]
9219:         siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
9219:   lwp_sigmask(SIG_SETMASK, 0x00000400, 0x00000000) = 0xFFBFFEFF [0x0000FFFF]
9219:   chdir("/var/opt/adnwebmail")                    = 0
9219:   sigaction(SIGSEGV, 0xFFBFEA38, 0xFFBFEAD8)      = 0
9219:   getpid()                                        = 9219 [9206]
9219:   getpid()                                        = 9219 [9206]
9219:   kill(9219, SIGSEGV)                             = 0
9219:   setcontext(0xFFBFEA38)
9219:       Received signal #11, SIGSEGV [default]
9219:         siginfo: SIGSEGV pid=9219 uid=80


Reproduce code:
---------------
Compile instructions:

PATH="/share/app/gnu/gcc/4.0.3/bin:/share/app/gnu/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin"
CC="gcc"
CFLAGS="-O3 -fPIC -Wall"
CXX="g++"
CXXFLAGS="-O3 -fPIC -Wall"
CPPFLAGS="-I/opt/adnwebmail/include"
LDFLAGS="-R/opt/adnwebmail/lib -L/opt/adnwebmail/lib -R/opt/adnwebmail/lib/sparcv9 -L/opt/adnwebmail/lib/sparcv9"
LD_OPTIONS="$LDFLAGS"

unset LD_LIBRARY_PATH
export PATH CC CFLAGS CXX CXXFLAGS LDFLAGS CPPFLAGS LD_OPTIONS
alias make=gmake

###
### Directories
###
mkdir -p /opt/adnwebmail/lib/sparcv9
mkdir -p /etc/opt/adnwebmail
mkdir -p /var/opt/adnwebmail

###
### Copy %$#@@! GCC libraries into package
###
cd /opt/adnwebmail/lib
cp /share/app/gnu/gcc/4.0.3/lib/libgcc_s.so.1 .
ln -s libgcc_s.so.1 libgcc_s.so

cd /opt/adnwebmail/lib/sparcv9
cp /share/app/gnu/gcc/4.0.3/lib/sparcv9/libgcc_s.so.1 .
ln -s libgcc_s.so.1 libgcc_s.so



cd /share/install/adnwebmail/1.4.9a-1/src

###
### OpenSSL
### http://www.openssl.org/
###
rm -rf /tmp/openssl-0.9.8d
gtar -C /tmp -xvpzf openssl-0.9.8d.tar.gz
cd /tmp/openssl-0.9.8d
./config --prefix=/opt/adnwebmail \
         --openssldir=/opt/adnwebmail/openssl shared \
         -R/opt/adnwebmail/lib -L/opt/adnwebmail/lib \
         -R/opt/adnwebmail/lib/sparcv9 -L/opt/adnwebmail/lib/sparcv9
gmake
gmake install
cd -

###
### OpenLDAP
### http://www.openldap.org/
###
rm -rf /tmp/openldap-2.3.31
gtar -C /tmp -xvpzf openldap-2.3.31.tgz
cd /tmp/openldap-2.3.31
./configure --prefix=/opt/adnwebmail \
            --sysconfdir=/etc/opt/adnwebmail \
            --disable-slapd --disable-slurpd \
            --localstatedir=/var/opt/adnwebmail \
            --with-tls
gmake depend
gmake
gmake install
cd -

###
### Apache Webserver
### http://httpd.apache.org/
###

rm -rf /tmp/httpd-2.2.3
gtar -C /tmp -xvzf httpd-2.2.3.tar.gz
cd /tmp/httpd-2.2.3
./configure --prefix=/var/opt/adnwebmail \
            --exec-prefix=/opt/adnwebmail \
            --includedir=/opt/adnwebmail/include \
            --infodir=/opt/adnwebmail/info \
            --mandir=/opt/adnwebmail/man \
            --sysconfdir=/etc/opt/adnwebmail \
            --datadir=/var/opt/adnwebmail \
            --enable-ssl \
            --with-ssl=/opt/adnwebmail \
            --enable-dav \
            --enable-dav-fs \
            --enable-dav-lock \
            --enable-auth-digest \
            --enable-so
gmake
gmake install
cd -

###
### LibXML
### http://www.xmlsoft.org/
###
rm -rf /tmp/libxml2-2.6.26
gtar -C /tmp -xvzf libxml2-2.6.26.tar.gz
cd /tmp/libxml2-2.6.26
./configure --prefix=/opt/adnwebmail \
            --datadir=/var/opt/adnwebmail \
            --sysconfdir=/etc/opt/adnwebmail
gmake
gmake install
cd -
###
### UW IMAP Client Libraries & Header Files (for PHP)
### http://www.washington.edu/imap/
###
rm -rf /tmp/imap-2006c1
gtar -C /tmp -xvzf imap-2006c1.tar.Z
cd /tmp/imap-2006c1
gmake gso SSLDIR=/opt/adnwebmail EXTRACFLAGS="-O3 -fPIC"
mkdir /opt/adnwebmail/include/c-client
cp c-client/*.h /opt/adnwebmail/include/c-client
cp c-client/c-client.a /opt/adnwebmail/lib/libc-client.a
cd -

###
### PHP
### http://www.php.net/
###
rm -rf /tmp/php-5.2.0
gtar -C /tmp -xvzf php-5.2.0.tar.gz
cd /tmp/php-5.2.0
./configure --prefix=/opt/adnwebmail \
            --with-apxs2=/opt/adnwebmail/bin/apxs \
            --with-ldap=/opt/adnwebmail \
            --with-imap=/opt/adnwebmail \
            --with-imap-ssl=/opt/adnwebmail \
            --with-ssl=/opt/adnwebmail \
            --with-libxml-dir=/opt/adnwebmail \
            --with-config-file-path=/etc/opt/adnwebmail \
            --enable-safe-mode \
            --without-pear
gmake
gmake install


Expected result:
----------------
no segmentation fault of Apache process

Actual result:
--------------
segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-04 10:23 UTC] tony2001@php.net
Please reopen the report if you're able to reproduce it with GCC 3.x on Solaris.

 [2007-01-05 07:34 UTC] deepblue2007 at bluewin dot ch
Compiled everything with GCC 3.4.1 on Solaris 9. Seems to work so far without segmentation fault.

%$#@! GNU Compiler ....
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 18:01:28 2025 UTC