gdb显示奇怪的无符号线程导致SIGSEGV - 它是什么?

时间:2015-11-06 11:37:49

标签: php linux gdb pthreads

我遇到php-cgi的问题,因为它经常发生段错误。父php-cgi产生210个其他人,这是其中一个失败的孩子。

我已经构建了它的调试副本(-g -O0)并为glibc等加载了调试符号。当我查看核心转储时,我得到了这个:

delivery101:/cored# gdb /usr/bin/php-cgi 28133_1446799964.core 
GNU gdb (GDB) CentOS (7.0.1-45.el5.centos)
Copyright (C) 2009 Free Software Foundation, Inc.

This GDB was configured as "x86_64-redhat-linux-gnu".

Reading symbols from /usr/bin/php-cgi...done.
Attaching to program: /usr/bin/php-cgi, process 28133
ptrace: No such process.
[New Thread 28195]
[New Thread 28133]
Reading symbols from /lib64/libcrypt.so.1...Reading symbols from /usr/lib/debug/lib64/libcrypt-2.5.so.debug...done
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /usr/lib64/libedit.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libedit.so.0
Reading symbols from /usr/lib64/libncurses.so.5...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libncurses.so.5
Reading symbols from /usr/lib64/libgmp.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libgmp.so.3
Reading symbols from /usr/lib64/libbz2.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libbz2.so.1
Reading symbols from /usr/lib64/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libz.so.1
Reading symbols from /lib64/librt.so.1...Reading symbols from /usr/lib/debug/lib64/librt-2.5.so.debug...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /lib64/libm.so.6...Reading symbols from /usr/lib/debug/lib64/libm-2.5.so.debug...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libdl.so.2...Reading symbols from /usr/lib/debug/lib64/libdl-2.5.so.debug...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libnsl.so.1...Reading symbols from /usr/lib/debug/lib64/libnsl-2.5.so.debug...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /usr/lib64/libxml2.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libxml2.so.2
Reading symbols from /usr/lib64/libgssapi_krb5.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libgssapi_krb5.so.2
Reading symbols from /usr/lib64/libkrb5.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libkrb5.so.3
Reading symbols from /usr/lib64/libk5crypto.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libk5crypto.so.3
Reading symbols from /lib64/libcom_err.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libcom_err.so.2
Reading symbols from /lib64/libssl.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libssl.so.6
Reading symbols from /lib64/libcrypto.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libcrypto.so.6
Reading symbols from /lib64/libc.so.6...Reading symbols from /usr/lib/debug/lib64/libc-2.5.so.debug...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libresolv.so.2...Reading symbols from /usr/lib/debug/lib64/libresolv-2.5.so.debug...done.
Loaded symbols for /lib64/libresolv.so.2
Reading symbols from /lib64/libpthread.so.0...Reading symbols from /usr/lib/debug/lib64/libpthread-2.5.so.debug...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib64/ld-2.5.so.debug...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/libkrb5support.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libkrb5support.so.0
Reading symbols from /lib64/libkeyutils.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libkeyutils.so.1
Reading symbols from /lib64/libselinux.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libselinux.so.1
Reading symbols from /lib64/libsepol.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libsepol.so.1
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libnss_files.so.2...Reading symbols from /usr/lib/debug/lib64/libnss_files-2.5.so.debug...done.
Loaded symbols for /lib64/libnss_files.so.2

warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff6956d000
Core was generated by `/usr/bin/php-cgi'.
    Program terminated with signal 11, Segmentation fault.
#0  0x00002af461e02678 in ?? ()

所以我看看那里有什么线程:

(gdb) info threads
  2 Thread 0x2af45de68af0 (LWP 28133)  0x000000315da48370 in krb5int_kt_finalize () from /usr/lib64/libkrb5.so.3
* 1 Thread 0x2af487823940 (LWP 28195)  0x00002af461e02678 in ?? ()

据我所知,线程1旁边的*表示这是导致段错误的线程。所以我仔细研究了一下:

(gdb) bt full
#0  0x00002af461e02678 in ?? ()
No symbol table info available.
#1  0x0000000018733e78 in ?? ()
No symbol table info available.
#2  0x00002af4878230c0 in ?? ()
No symbol table info available.
#3  0x00002af487823100 in ?? ()
No symbol table info available.
#4  0x00002af461dfed8d in ?? ()
No symbol table info available.
#5  0x0000000000000000 in ?? ()
No symbol table info available.

我不知道线程的来源(或如何找出),我看不出回溯的用途;缺少符号只是因为我没有为所有内容加载符号,或者它是否表明问题本身(缓冲区溢出?)

我的问题是:我怎样才能找到这个帖子的来源和内容?

如果您需要更多详情,请告诉我。

1 个答案:

答案 0 :(得分:0)

  

如何找出此主题的来源及内容?

您可能有几种可能的无用堆栈跟踪:

  1. 您正在分析由优化的php-cgi生成的核心,但为GDB提供php-cgi的调试版本。这根本不起作用:您需要使用生成该核心的二进制文件来分析核心。
  2. 您可能正在分析机器(例如开发)上的核心转储,这与生产核心的机器(例如生产)不同。可以这样做,但是您必须小心使GDB使用核心转储时使用的共享库的完全版本。
  3. 有可能在为glibc等安装调试符号时,您还更新了一些库,导致核心转储时使用的内容与分析时使用的内容不匹配。
  4. php-cgi可能使用某种JIT编译,并且崩溃发生在JIT代码中。
  5. 程序可能只是跳转到与任何功能都不对应的随机地址。