Bug #9088

SEGV with set_trace_func and break

Added by Akira Tanaka almost 2 years ago. Updated almost 2 years ago.

[ruby-dev:47793]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:ruby 2.1.0dev (2013-11-06 trunk 43555) [x86_64-linux] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

以下のようにすると SEGV します。

% ./ruby -e '

set_trace_func proc {raise rescue nil}
1.times do
break
end
'
-e:2: [BUG] Segmentation fault
ruby 2.1.0dev (2013-11-06 trunk 43555) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0012 e:000011 CFUNC :raise
c:0004 p:0007 s:0009 e:000008 BLOCK -e:2 [FINISH]
c:0003 p:---- s:0007 e:000006 CFUNC :times
c:0002 p:0014 s:0004 E:001d28 EVAL -e:3 [FINISH]
c:0001 p:0000 s:0002 E:0025c8 TOP [FINISH]

-e:3:in <main>'
-e:3:in
times'
-e:2:in block in <main>'
-e:2:in
raise'

-- C level backtrace information -------------------------------------------
./ruby(+0x178767) [0x7f2bc62dd767]
./ruby(+0x17883c) [0x7f2bc62dd83c]
./ruby(+0x1d4156) [0x7f2bc6339156]
./ruby(rb_bug+0xdf) [0x7f2bc63392d0]
./ruby(+0xef229) [0x7f2bc6254229]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf030) [0x7f2bc5d36030] ../nptl/sysdeps/pthread/funlockfile.c:30
./ruby(+0x16aca1) [0x7f2bc62cfca1]
./ruby(+0x16aded) [0x7f2bc62cfded]
./ruby(+0x16da81) [0x7f2bc62d2a81]
./ruby(rb_check_funcall+0x48) [0x7f2bc62d2c95]
./ruby(+0x783b2) [0x7f2bc61dd3b2]
./ruby(rb_check_convert_type+0x50) [0x7f2bc61dd546]
./ruby(rb_check_string_type+0x2b) [0x7f2bc6265f9c]
./ruby(+0x2790a) [0x7f2bc618c90a]
./ruby(rb_make_exception+0x25) [0x7f2bc618ca8f]
./ruby(+0x2789b) [0x7f2bc618c89b]
./ruby(+0x15eb7b) [0x7f2bc62c3b7b]
./ruby(+0x15f725) [0x7f2bc62c4725]
./ruby(+0x15f832) [0x7f2bc62c4832]
./ruby(+0x1646ec) [0x7f2bc62c96ec]
./ruby(+0x17413d) [0x7f2bc62d913d]
./ruby(+0x172af7) [0x7f2bc62d7af7]
./ruby(+0x172d61) [0x7f2bc62d7d61]
./ruby(+0x172e09) [0x7f2bc62d7e09]
./ruby(rb_proc_call_with_block+0x68) [0x7f2bc6190140]
./ruby(+0x17cf70) [0x7f2bc62e1f70]
./ruby(+0x17c2c4) [0x7f2bc62e12c4]
./ruby(+0x17c478) [0x7f2bc62e1478]
./ruby(+0x17c568) [0x7f2bc62e1568]
./ruby(+0x1742d3) [0x7f2bc62d92d3]
./ruby(rb_iseq_eval_main+0x34) [0x7f2bc62da0ae]
./ruby(+0x26d8d) [0x7f2bc618bd8d]
./ruby(ruby_exec_node+0x24) [0x7f2bc618bea6]
./ruby(ruby_run_node+0x3e) [0x7f2bc618be79]
./ruby(+0x24dc1) [0x7f2bc6189dc1]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7f2bc4e87ead] libc-start.c:228
./ruby(+0x24c49) [0x7f2bc6189c49]

-- Other runtime information -----------------------------------------------

  • Loaded script: -e

  • Loaded features:

    0 enumerator.so
    1 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/encdb.so
    2 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/trans/transdb.so
    3 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/rbconfig.rb
    4 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/compatibility.rb
    5 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/defaults.rb
    6 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/deprecate.rb
    7 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/errors.rb
    8 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/version.rb
    9 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/requirement.rb
    10 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/platform.rb
    11 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/basic_specification.rb
    12 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/stub_specification.rb
    13 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/specification.rb
    14 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/exceptions.rb
    15 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
    16 /home/ruby/tst1/lib/ruby/2.1.0/thread.rb
    17 /home/ruby/tst1/lib/ruby/2.1.0/monitor.rb
    18 /home/ruby/tst1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb
    19 /home/ruby/tst1/lib/ruby/2.1.0/rubygems.rb

  • Process memory map:

7f2bc4663000-7f2bc4678000 r-xp 00000000 08:01 2416670 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2bc4678000-7f2bc4878000 ---p 00015000 08:01 2416670 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2bc4878000-7f2bc4879000 rw-p 00015000 08:01 2416670 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2bc4879000-7f2bc487b000 r-xp 00000000 08:01 4186651 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/trans/transdb.so
7f2bc487b000-7f2bc4a7b000 ---p 00002000 08:01 4186651 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/trans/transdb.so
7f2bc4a7b000-7f2bc4a7c000 rw-p 00002000 08:01 4186651 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/trans/transdb.so
7f2bc4a7c000-7f2bc4a7e000 r-xp 00000000 08:01 4186632 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/encdb.so
7f2bc4a7e000-7f2bc4c7d000 ---p 00002000 08:01 4186632 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/encdb.so
7f2bc4c7d000-7f2bc4c7e000 rw-p 00001000 08:01 4186632 /home/ruby/tst1/lib/ruby/2.1.0/x86_64-linux/enc/encdb.so
7f2bc4c7e000-7f2bc4e69000 r--p 00000000 08:01 9978604 /usr/lib/locale/locale-archive
7f2bc4e69000-7f2bc4fe9000 r-xp 00000000 08:01 2419615 /lib/x86_64-linux-gnu/libc-2.13.so
7f2bc4fe9000-7f2bc51e9000 ---p 00180000 08:01 2419615 /lib/x86_64-linux-gnu/libc-2.13.so
7f2bc51e9000-7f2bc51ed000 r--p 00180000 08:01 2419615 /lib/x86_64-linux-gnu/libc-2.13.so
7f2bc51ed000-7f2bc51ee000 rw-p 00184000 08:01 2419615 /lib/x86_64-linux-gnu/libc-2.13.so
7f2bc51ee000-7f2bc51f3000 rw-p 00000000 00:00 0
7f2bc51f3000-7f2bc5274000 r-xp 00000000 08:01 2417137 /lib/x86_64-linux-gnu/libm-2.13.so
7f2bc5274000-7f2bc5473000 ---p 00081000 08:01 2417137 /lib/x86_64-linux-gnu/libm-2.13.so
7f2bc5473000-7f2bc5474000 r--p 00080000 08:01 2417137 /lib/x86_64-linux-gnu/libm-2.13.so
7f2bc5474000-7f2bc5475000 rw-p 00081000 08:01 2417137 /lib/x86_64-linux-gnu/libm-2.13.so
7f2bc5475000-7f2bc547d000 r-xp 00000000 08:01 2419616 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7f2bc547d000-7f2bc567c000 ---p 00008000 08:01 2419616 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7f2bc567c000-7f2bc567d000 r--p 00007000 08:01 2419616 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7f2bc567d000-7f2bc567e000 rw-p 00008000 08:01 2419616 /lib/x86_64-linux-gnu/libcrypt-2.13.so
7f2bc567e000-7f2bc56ac000 rw-p 00000000 00:00 0
7f2bc56ac000-7f2bc56ae000 r-xp 00000000 08:01 2417131 /lib/x86_64-linux-gnu/libdl-2.13.so
7f2bc56ae000-7f2bc58ae000 ---p 00002000 08:01 2417131 /lib/x86_64-linux-gnu/libdl-2.13.so
7f2bc58ae000-7f2bc58af000 r--p 00002000 08:01 2417131 /lib/x86_64-linux-gnu/libdl-2.13.so
7f2bc58af000-7f2bc58b0000 rw-p 00003000 08:01 2417131 /lib/x86_64-linux-gnu/libdl-2.13.so
7f2bc58b0000-7f2bc5917000 r-xp 00000000 08:01 10274367 /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.5
7f2bc5917000-7f2bc5b17000 ---p 00067000 08:01 10274367 /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.5
7f2bc5b17000-7f2bc5b1f000 rw-p 00067000 08:01 10274367 /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.5
7f2bc5b1f000-7f2bc5b26000 r-xp 00000000 08:01 2417134 /lib/x86_64-linux-gnu/librt-2.13.so
7f2bc5b26000-7f2bc5d25000 ---p 00007000 08:01 2417134 /lib/x86_64-linux-gnu/librt-2.13.so
7f2bc5d25000-7f2bc5d26000 r--p 00006000 08:01 2417134 /lib/x86_64-linux-gnu/librt-2.13.so
7f2bc5d26000-7f2bc5d27000 rw-p 00007000 08:01 2417134 /lib/x86_64-linux-gnu/librt-2.13.so
7f2bc5d27000-7f2bc5d3e000 r-xp 00000000 08:01 2417030 /lib/x86_64-linux-gnu/libpthread-2.13.so
7f2bc5d3e000-7f2bc5f3d000 ---p 00017000 08:01 2417030 /lib/x86_64-linux-gnu/libpthread-2.13.so
7f2bc5f3d000-7f2bc5f3e000 r--p 00016000 08:01 2417030 /lib/x86_64-linux-gnu/libpthread-2.13.so
7f2bc5f3e000-7f2bc5f3f000 rw-p 00017000 08:01 2417030 /lib/x86_64-linux-gnu/libpthread-2.13.so
7f2bc5f3f000-7f2bc5f43000 rw-p 00000000 00:00 0
7f2bc5f43000-7f2bc5f63000 r-xp 00000000 08:01 2419619 /lib/x86_64-linux-gnu/ld-2.13.so
7f2bc603c000-7f2bc6142000 rw-p 00000000 00:00 0
7f2bc6154000-7f2bc6155000 rw-p 00000000 00:00 0
7f2bc6155000-7f2bc615c000 r--s 00000000 08:01 10388551 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f2bc615c000-7f2bc615d000 ---p 00000000 00:00 0
7f2bc615d000-7f2bc6162000 rw-p 00000000 00:00 0
7f2bc6162000-7f2bc6163000 r--p 0001f000 08:01 2419619 /lib/x86_64-linux-gnu/ld-2.13.so
7f2bc6163000-7f2bc6164000 rw-p 00020000 08:01 2419619 /lib/x86_64-linux-gnu/ld-2.13.so
7f2bc6164000-7f2bc6165000 rw-p 00000000 00:00 0
7f2bc6165000-7f2bc6407000 r-xp 00000000 08:01 1584001 /home/ruby/tst1/ruby/ruby
7f2bc6607000-7f2bc660d000 rw-p 002a2000 08:01 1584001 /home/ruby/tst1/ruby/ruby
7f2bc660d000-7f2bc6634000 rw-p 00000000 00:00 0
7f2bc7be7000-7f2bc8049000 rw-p 00000000 00:00 0 [heap]
7fffda08e000-7fffda0af000 rw-p 00000000 00:00 0 [stack]
7fffda1c4000-7fffda1c5000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Associated revisions

Revision 43561
Added by Nobuyoshi Nakada almost 2 years ago

vm_trace.c: isolate errinfo in trace blocks

  • vm_trace.c (rb_threadptr_exec_event_hooks_orig): errinfo should not be propagated to trace blocks so that no argument raise does not throw internal objects. [Bug #9088]

Revision 43561
Added by Nobuyoshi Nakada almost 2 years ago

vm_trace.c: isolate errinfo in trace blocks

  • vm_trace.c (rb_threadptr_exec_event_hooks_orig): errinfo should not be propagated to trace blocks so that no argument raise does not throw internal objects. [Bug #9088]

History

#1 Updated by Nobuyoshi Nakada almost 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43561.
Akira, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vm_trace.c: isolate errinfo in trace blocks

  • vm_trace.c (rb_threadptr_exec_event_hooks_orig): errinfo should not be propagated to trace blocks so that no argument raise does not throw internal objects. [Bug #9088]

Also available in: Atom PDF