Project

General

Profile

Bug #12850

SEGV in C level backtrace information

Added by znz (Kazuhiro NISHIYAMA) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-10-18 trunk 56445) [x86_64-linux]
[ruby-dev:49840]

Description

Ubuntu 16.04.1 LTS の環境で、r56445 の変更の影響で SEGV のテストの C level backtrace information の表示で SEGV します。

% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2)
% gdb -q --args ruby --disable-gems -v -e 'Process.kill :SEGV, $$'
Reading symbols from ruby...done.
(gdb) run
Starting program: /home/vagrant/build/ruby-git/ruby --disable-gems -v -e Process.kill\ :SEGV,\ \$\$
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7ff5700 (LWP 5839)]
ruby 2.4.0dev (2016-10-18 trunk 56445) [x86_64-linux]

Thread 1 "ruby" received signal SIGSEGV, Segmentation fault.
0x00007ffff7537757 in kill () at ../sysdeps/unix/syscall-template.S:84
84      ../sysdeps/unix/syscall-template.S: そのようなファイルやディレクトリはありません.
(gdb) c
Continuing.
-e:1: [BUG] Segmentation fault at 0x000384000016b9
ruby 2.4.0dev (2016-10-18 trunk 56445) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0012 e:000011 CFUNC  :kill
c:0002 p:0016 s:0006 e:000005 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0003 E:001e60 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
-e:1:in `kill'

-- Machine register context ------------------------------------------------
 RIP: 0x00007ffff7537757 RBP: 0x0000000000602f70 RSP: 0x00007fffffffd328
 RAX: 0x0000000000000000 RBX: 0x0000000000603728 RCX: 0x00007ffff7537757
 RDX: 0x0000000000000000 RDI: 0x00000000000016b9 RSI: 0x000000000000000b
  R8: 0x0000000000603728  R9: 0x0000000000000005 R10: 0x000000000000022d
 R11: 0x0000000000000206 R12: 0x0000000000000002 R13: 0x00000000000016b9
 R14: 0x0000000000000001 R15: 0x0000000000000001 EFL: 0x0000000000000206

-- C level backtrace information -------------------------------------------

Thread 1 "ruby" received signal SIGSEGV, Segmentation fault.
parse_debug_line_cu (offset=0, lines=0x7657c0, obj=0x765cb0, debug_line=<synthetic pointer>,
    traces=0x7ffff7dd31c0 <trace>, num_traces=18) at /home/vagrant/s/github.com/ruby/ruby/addr2line.c:291
291         while (*p) {
(gdb) p p
$1 = 0x8000f5f977f7 <error: Cannot access memory at address 0x8000f5f977f7>
(gdb)

Associated revisions

Revision 685a436a
Added by nobu (Nobuyoshi Nakada) over 2 years ago

addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 56446
Added by nobu (Nobuyoshi Nakada) over 2 years ago

addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

Revision 56446
Added by nobu (Nobuyoshi Nakada) over 2 years ago

addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

Revision 56446
Added by nobu (Nobuyoshi Nakada) over 2 years ago

addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

Revision 56446
Added by nobu (Nobuyoshi Nakada) over 2 years ago

addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

History

Updated by znz (Kazuhiro NISHIYAMA) over 2 years ago

http://rubyci.org/ の Ubuntu 16.04 x86_64 では通っているように見えるので、違いを調べてみたところ、--enable-shared を外すと手元でも大丈夫になりました。

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

--enable-sharedのときしか有効にしていないからでしょう。
シグナルハンドラでzlib呼び出すのはかなり怖いので、revertしますかね。

#3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Assigned to Closed

Applied in changeset r56446.


addr2line.c: boundary checks

  • addr2line.c (parse_debug_line_cu): boundary checks for compressed debug sections. [ruby-dev:49840] [Bug #12850]

Also available in: Atom PDF