While working on a Perl program to parse Apache access logs, I came across Apache::LogRegex (http://search.cpan.org/~peterhi/Apache-LogRegex/lib/Apache/LogRegex.pm). When I fed a simple script my access log, Perl crashed with a segmentation fault. First I isolated the problem to the regular expression used by Apache::LogRegex (see test.pl, to be attached). I also isolated the problem to one specific line of my access log (see line.txt, to be attached). The resulting backtrace will also be attached. The script works on a stock Perl 5.8.4 installation, so I commented out the Gentoo patches in /usr/portage/dev-lang/perl/perl-5.8.4-r1.ebuild. The script worked until I enabled perl-5.8.4-picdl.patch. I don't know what this patch does exactly, so I can't say if its necessary on my system. Perl did seem to run without it, however. Reproducible: Always Steps to Reproduce: 1. perl test.pl < line.txt Actual Results: Perl segfaults. Expected Results: The following should be printed (part of the request is removed for the sake of brevity): $VAR1 = [ 'sabrina.webadmin.ufl.edu', '61.238.168.196', '-', '-', '[02/Aug/2004:13:42:44 -0400]', 'SEARCH [...]', '414', '352', '-', '-' ]; 1 Portage 2.0.50-r11 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.8.1) ================================================================= System uname: 2.6.8.1 i686 Intel(R) Xeon(TM) CPU 2.40GHz Gentoo Base System version 1.4.16 distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-mcpu=pentium4 -O2 -pipe -g3" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-mcpu=pentium4 -O2 -pipe -g3" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distcc nostrip sandbox userpriv" GENTOO_MIRRORS="http://open-systems.ufl.edu/mirrors/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://bugs.webadmin.ufl.edu/gentoo-portage" USE="X aalib acpi alsa apm avi berkdb bitmap-fonts cdr crypt cups debug divx4linux dvd encode foomaticdb gdbm gif gnome gpm gtk gtk2 gtkhtml imlib java jpeg kde libg++ libwww mad maildir mikmod mmx motif mozilla mpeg ncurses nls oggvorbis opengl oss pam pdflib perl png ppds python qt quicktime readline sdl slang spell ssl svga tcpd tiff truetype x86 xml xml2 xmms xprint xv xvid zlib"
Created attachment 40333 [details] Test script illustrating the segfault This script takes lines from an Apache access log on STDIN, parses them using a regular expression, and prints the results using Data::Dumper.
Created attachment 40334 [details] Line from my Apache access log which illustrates the problem Feed this to the test script, e.g. perl test.pl < line.txt.
Created attachment 40335 [details] gdb backtrace of segfault (gzipped)
This still occurs on dev-lang/perl-5.8.5-r2 and the corresponding sys-devel/libperl-5.8.5 with a similar segmentation fault.
Daniel, I am afraid I am just now backtracking through the neglected pile of perl@g.o bugs. Did you post this to perl-porters? I'm looking through why the patch was ever applied, not even convinced it affected us (and yet at the same, not convinced it didn't affect some archs at the same time). bah. i hate finding old, interesting bugs.
Hi, Michael. Thanks for getting back to me. I'm not on p5p, so I did not raise the issue there. I know very little about PIC, but I found a post from 2002 about something related: http://groups-beta.google.com/group/perl.perl5.porters/browse_thread/thread/fb39cdf3020d0942?fwc=1 If I can help test anything, let me know.
Mass re-assign.
Closing this, feel free to reopen if it's still an issue w/ latest stable perl (5.8.8-r2 ATM). *** This bug has been marked as a duplicate of 72109 ***
(In reply to comment #9) > Closing this, feel free to reopen if it's still an issue w/ latest stable perl > (5.8.8-r2 ATM). The segfault still occurs on 5.8.8-r2. The test script attached to bug 72109 works with or without the picdl patch, as does the simplified test case at http://www.livejournal.com/community/perl/61223.html (mentioned in bug 72109). This bug is definitely a case of stack smashing, since increasing the limit causes the problem to go away: [13:56:25 dwc@fortuna ~]$ ulimit -s 8192 [13:56:30 dwc@fortuna ~]$ perl test.pl < line.txt Segmentation fault [13:57:46 dwc@fortuna ~]$ ulimit -s 16384 [13:57:48 dwc@fortuna ~]$ perl test.pl < line.txt (expected test output) Disabling the picdl patch still "fixes" the issue regardless of stack size, though may create other problems I'm not seeing. I think this is still a bug, though I'll understand if it's considered a WONTFIX.
(In reply to comment #10) > The segfault still occurs on 5.8.8-r2. > > The test script attached to bug 72109 works with or without the picdl patch, as > does the simplified test case at > http://www.livejournal.com/community/perl/61223.html (mentioned in bug 72109). Not here. Can't reproduce any segfault.
(In reply to comment #11) > Not here. Can't reproduce any segfault. Interesting. mcummings was able to reproduce it in one location, so I'm not totally crazy. ;) yuval also pointed me to http://rt.perl.org/rt3/Public/Bug/Display.html?id=38717 - which mentions some similar issues. I'm content to close this, as it seems to be a perl issue and not a packaging one. The picdl patch seems to have been a false data point.