Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 111451 - Segfaults when using mod_include and mod_php with Apache 2.0.55 and PHP 5.0.5-r3
Summary: Segfaults when using mod_include and mod_php with Apache 2.0.55 and PHP 5.0.5-r3
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-04 01:49 UTC by Tobias Klausmann (RETIRED)
Modified: 2005-11-08 02:47 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
gdb backtrace (apache-bt.txt,2.48 KB, text/plain)
2005-11-04 01:49 UTC, Tobias Klausmann (RETIRED)
Details
GDB log with proper debugging (gdb.log,2.98 KB, text/plain)
2005-11-04 07:16 UTC, Tobias Klausmann (RETIRED)
Details
strace log (strace.log,120.12 KB, text/plain)
2005-11-04 07:17 UTC, Tobias Klausmann (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 01:49:21 UTC
I'm using the following construct in one of my sites extensively:

All the pages are .shtml files using server-side includes (SSI) for various
snippets like headers, footers and the like. One of those includes is a menu.
This one is special as it is a PHP file which gets executed. This has worked
fine for years now.

On Nov 1st I updated PHP to 5.0.5-r2, since then, all the files that #include
both a plain and a PHP snippet will result in a segfault of the corresponding
Apache worker (I'm using mpm_prefork).

Steps to reproduce:
Configure Apache to allow SSI on files ending in .shtml. Create a test file with
two statements like this:

<!--#include file="test1.shtml" -->
<!--#include file="test2.php" -->

The shtml file can contain just about anything you like, just don't put any PHP
code there.

Then, create test.php with any PHP code (in <?php... ?>) you like, I suggest
something that changes with every reload like printing date and time.

Try to load the shtml file in your browser and closely watch the server-wide
error logfile, you should see a message about an Apache process receiving a SegV
and dying.

I updated to -r3 today, that did not help. I've also run Apache in gdb and
created a backtrace - I'll attach it.

I don't know if this is an upstream bug, but I doubt it since I haven't found
anyone with the same problem. Maybe one of the numerous PHP patches is the
culprit, but my C-fu is too weak to find out.

emerge info:
Portage 2.0.53_rc7 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r3, 2.6.13
i686)
=================================================================
System uname: 2.6.13 i686 Pentium III (Katmai)
Gentoo Base System version 1.12.0_pre9
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.13
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://ftp.freenet.de/pub/ftp.snt.utwente.nl/pub/os/linux/gentoo/
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ "
LANG="en_US"
LC_ALL="en_US"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync5.de.gentoo.org/gentoo-portage"
USE="x86 acpi alsa apache2 apm bash-completion bcmath berkdb bitmap-fonts bzlib
crypt cscope curl eds emboss encode esd exif exiscan-acl flatfile fortran ftp gd
gdbm gif gmp gpm gstreamer gtk gtk2 iconv idea imagemagick imap imlib imlib2
ipv6 jabber java jpeg kde libg++ libwww mad maildir mbox memlimit mhash mikmod
mime mng motif moznocompose moznoirc moznomail mp3 mpeg mpeg4 mpi mpm-prefork
msn mysql ncurses nls ogg oggvorbis openssh oscar pam parse-clocks pcap pcre
pdflib pear-db perl php plotutils png posix python readline session sharedmem
simplexml skey slang spell sqlite sse ssl sysvipc tcltk tcpd tidy tiff truetype
truetype-fonts type1 type1-fonts udev vorbis xchatnogtk xchattext xml xml2 xpm
xsl yahoo zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, LINGUAS
Comment 1 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 01:49:53 UTC
Created attachment 72089 [details]
gdb backtrace
Comment 2 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 01:51:14 UTC
To clarify:

with "Try to load the shtml file in your browser" I mean loading the first file
you created (the one with the include directives).
Comment 3 Luca Longinotti (RETIRED) gentoo-dev 2005-11-04 05:20:46 UTC
Hmm 5.0.5-r3 added a patch to prevent crashes with Apache2, but a part of that
patch was faulty, so I fixed that and added 5.0.5-r4 to the tree, please test
with that one and, if the problem persists, reopen the bug, thanks!
Best regards, CHTEKK.
Comment 4 Luca Longinotti (RETIRED) gentoo-dev 2005-11-04 05:24:20 UTC
And if you reopen or anyways in the future, please provide useful GDB
backtraces: you must compile with the USE flag "debug" enabled and add "-g
-ggdb3" to your C[XX]FLAGS, as well as "nostrip" to your FEATURES. Also, a
strace of what happens is useful to complement the GDB backtrace, for more
informations on this please take a look at [1], thanks.
Best regards, CHTEKK.

[1] http://www.gentoo.org/doc/en/bugzilla-howto.xml#doc_chap2
Comment 5 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 06:55:05 UTC
Emerging -r4 did not help. I'll recompile with the proper debugging flags and
provide a backtrace and an strace, but it will be a while until then since the
machine isn't all that fast.
Comment 6 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 07:15:55 UTC
Another thing I noticed: it only happens if the included files are in a
subdirectory. Sorry I forgot to mention that.
Comment 7 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 07:16:23 UTC
Created attachment 72096 [details]
GDB log with proper debugging
Comment 8 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-04 07:17:16 UTC
Created attachment 72098 [details]
strace log

strace cmdline: strace -Ff -o strace.log /usr/sbin/apache2 -X -D PHP5 -D
USERDIR -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start
Comment 9 Sebastian Bergmann (RETIRED) gentoo-dev 2005-11-08 02:14:59 UTC
The PHP Manual has a note that including PHP sourcefiles via SSI is not
supported, and was never intended to work.
Comment 10 Tobias Klausmann (RETIRED) gentoo-dev 2005-11-08 02:47:58 UTC
So this means I've been using something that wasn't supposed to work for about
three years? Strange. But well, that's how it is. Thanks and sorry for wasting
your time.