Jump to content

Segmentation Fault


shelluk

Recommended Posts

Hi

 

I have a php script which is piped to by my mail server (exim). It runs and does what it needs to do, I even have as the last 2 lines the following, which run and print "Done"!

 

exit("Done");
?>

 

Yet the script terminates with "Segmentation fault (core dumped)".

 

I have tried to do a backtrace on the core dump file but with no luck. Never gone in to to gdb and backtraces before so don't really know what I'm doing to be honest. I've tried recompiling php with --enable-debug which I am assuming it has done but I am not sure how to check.

 

# gdb /usr/bin/php5 /tmp/core-dumps/core-php.30729
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/php5...Reading symbols from /usr/lib/debug/usr/bin/php5...done.
(no debugging symbols found)...done.


warning: core file may not match specified executable file.
[New Thread 30729]


warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/i686/cmov/libcrypt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libcrypt.so.1
Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/libonig.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libonig.so.2
Reading symbols from /usr/lib/i686/cmov/libssl.so.0.9.8...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i686/cmov/libssl.so.0.9.8
Reading symbols from /usr/lib/libdb-4.8.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libdb-4.8.so
Reading symbols from /usr/lib/libqdbm.so.14...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libqdbm.so.14
Reading symbols from /lib/libbz2.so.1.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libbz2.so.1.0
Reading symbols from /lib/libpcre.so.3...(no debugging symbols found)...done.
Loaded symbols for /lib/libpcre.so.3
Reading symbols from /lib/i686/cmov/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libm.so.6
Reading symbols from /lib/i686/cmov/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libdl.so.2
Reading symbols from /lib/i686/cmov/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libnsl.so.1
Reading symbols from /usr/lib/libgssapi_krb5.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgssapi_krb5.so.2
Reading symbols from /usr/lib/libkrb5.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libkrb5.so.3
Reading symbols from /usr/lib/libk5crypto.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libk5crypto.so.3
Reading symbols from /lib/libcom_err.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libcom_err.so.2
Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /lib/i686/cmov/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libc.so.6
Reading symbols from /usr/lib/i686/cmov/libcrypto.so.0.9.8...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i686/cmov/libcrypto.so.0.9.8
Reading symbols from /lib/i686/cmov/libresolv.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libresolv.so.2
Reading symbols from /lib/i686/cmov/libpthread.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libpthread.so.0
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/libkrb5support.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libkrb5support.so.0
Reading symbols from /lib/libkeyutils.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libkeyutils.so.1
Reading symbols from /usr/lib/libxcb.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb.so.1
Reading symbols from /lib/i686/cmov/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/librt.so.1
Reading symbols from /usr/lib/libXau.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXau.so.6
Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXdmcp.so.6
Reading symbols from /usr/lib/php5/20090626+lfs/suhosin.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626+lfs/suhosin.so
Reading symbols from /lib/i686/cmov/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/i686/cmov/libnss_files.so.2
Core was generated by `php -q ./mailReader.php'.
Program terminated with signal 11, Segmentation fault.
#0 0xb6472562 in ?? ()


(gdb) bt
#0  0xb6472562 in ?? ()
#1  0xb647269b in ?? ()
#2  0xb6470d40 in ?? ()
#3  0xb6f96955 in start_thread () from /lib/i686/cmov/libpthread.so.0
#4  0xb71e31de in clone () from /lib/i686/cmov/libc.so.6

 

# uname -a
Linux eeever 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux

 

PHP Version => 5.3.3-7+squeeze14

 

I think the issue is "no debugging symbols found". I install php5-dbg but it clearly hasn't worked.

 

Has any one either any idea why it is seg faulting even though it executes to the end, or what I'm doing wrong with trying to debug it please?

Link to comment
Share on other sites

How about stracing the script with "strace ..."? It'll probably output a lot.

 

Thanks requinix.

 

I've done that, after some read and writes as expected, it ends with:

 

 

close(3)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
This is the last line of the script. Done.
Segmentation fault

 

I've set the last line of the script to:

exit("This is the last line of the script. Done.".PHP_EOL);

 

I am, confused.

Link to comment
Share on other sites

From what I could get from the stacktrace, which I cannot guarantee is correct, is that the problem seems to lie within the Soushin patch. Dealing with Kerberos encryption related to SSL and/or compression. Not a whole lot to go from, without the debugging symbols, I'm afraid. :-\

 

In any case, you might want to get in touch with the mailinglist/author of the Soushin patch, they/he should be able to help you further.

Edited by Christian F.
Link to comment
Share on other sites

Thanks to both of you. Decided to go digging after you both mentioned extensions. It turned out to be imagick! All up to date with the stable branch of Debian so had to force a newer version of imagick down through the testing branch. I've escaped alive and with everything now working.

 

The fact it was completing the script up to the last line was throwing me, I thought it would be bombing out before if it was a seg fault.

 

Thank you! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.