Project

General

Profile

Actions

Bug #12137

closed

Ruby2.3 blk.binding crashes instead of giving "Can't create Binding from C level Proc (ArgumentError)"

Added by zeha (Christian Hofstaedtler) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu] (Debian 2.3.0-4)
[ruby-core:74100]

Description

The following code raises an ArgumentError on 2.2. On 2.3, it crashes in binding.

def repro(&blk)
  blk.binding
  nil
end

repro(&:succ)

Output 2.2:

crash.rb:2:in `binding': Can't create Binding from C level Proc (ArgumentError)
	from crash.rb:2:in `repro'
	from crash.rb:6:in `<main>'

Output 2.3:

crash.rb:2: [BUG] Segmentation fault at 0x000000000b911c
ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0011 e:000010 CFUNC  :binding
c:0003 p:0009 s:0008 e:000007 METHOD crash.rb:2
c:0002 p:0021 s:0004 E:001740 EVAL   crash.rb:6 [FINISH]
c:0001 p:0000 s:0002 E:0024f0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
crash.rb:6:in `<main>'
crash.rb:2:in `repro'
crash.rb:2:in `binding'

-- Machine register context ------------------------------------------------
 RIP: 0x00007fad9c743aca RBP: 0x0000000001905920 RSP: 0x00007fff18c268e0
 RAX: 0x0000000001760ce0 RBX: 0x00000000000b910c RCX: 0x0000000000000001
 RDX: 0x0000000000000000 RDI: 0x0000000001525a00 RSI: 0x0000000000000018
  R8: 0x0000000001905920  R9: 0x0000000001525a00 R10: 0x00007fff18c26b30
 R11: 0x0000000000000002 R12: 0x0000000001760ce0 R13: 0x0000000000000000
 R14: 0x00007fad9cd56f50 R15: 0x0000000001630e70 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(rb_print_backtrace+0x15) [0x7fad9c85b7a5] vm_dump.c:688
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(rb_vm_bugreport+0x21c) [0x7fad9c85b9dc] vm_dump.c:997
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(rb_bug_context+0xd4) [0x7fad9c736334] error.c:435
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(sigsegv+0x3e) [0x7fad9c7e7b2e] signal.c:890
/lib/x86_64-linux-gnu/libpthread.so.0 [0x7fad9c4ba660]
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(proc_binding+0x6a) [0x7fad9c743aca] proc.c:2663
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(vm_call_cfunc+0x10b) [0x7fad9c8491db] vm_insnhelper.c:1638
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(vm_call_method_each_type+0x73) [0x7fad9c856ff3] vm_insnhelper.c:2022
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(vm_call_general+0xe3) [0x7fad9c858023] vm_insnhelper.c:2172
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(vm_exec_core+0x11d9) [0x7fad9c84cf29] insns.def:995
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(vm_exec+0x82) [0x7fad9c851c92] vm.c:1645
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(ruby_exec_internal+0xbd) [0x7fad9c7396dd] eval.c:244
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(ruby_exec_node+0x1d) [0x7fad9c73b0ed] eval.c:309
/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3(ruby_run_node+0x1e) [0x7fad9c73d20e] eval.c:301
ruby2.3 [0x40089b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fad9b763870]
ruby2.3(_start+0x29) [0x4008c9]

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

* Loaded script: crash.rb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/encdb.so
    5 /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/trans/transdb.so
    6 /usr/lib/ruby/2.3.0/unicode_normalize.rb
    7 /usr/lib/x86_64-linux-gnu/ruby/2.3.0/rbconfig.rb
    8 /usr/lib/ruby/2.3.0/rubygems/compatibility.rb
    9 /usr/lib/ruby/2.3.0/rubygems/defaults.rb
   10 /usr/lib/ruby/2.3.0/rubygems/deprecate.rb
   11 /usr/lib/ruby/2.3.0/rubygems/errors.rb
   12 /usr/lib/ruby/2.3.0/rubygems/version.rb
   13 /usr/lib/ruby/2.3.0/rubygems/requirement.rb
   14 /usr/lib/ruby/2.3.0/rubygems/platform.rb
   15 /usr/lib/ruby/2.3.0/rubygems/basic_specification.rb
   16 /usr/lib/ruby/2.3.0/rubygems/stub_specification.rb
   17 /usr/lib/ruby/2.3.0/rubygems/util/list.rb
   18 /usr/lib/x86_64-linux-gnu/ruby/2.3.0/stringio.so
   19 /usr/lib/ruby/2.3.0/rubygems/specification.rb
   20 /usr/lib/ruby/2.3.0/rubygems/exceptions.rb
   21 /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb
   22 /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb
   23 /usr/lib/ruby/2.3.0/monitor.rb
   24 /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
   25 /usr/lib/ruby/2.3.0/rubygems.rb
   26 /usr/lib/ruby/vendor_ruby/did_you_mean/version.rb
   27 /usr/lib/ruby/vendor_ruby/did_you_mean/core_ext/name_error.rb
   28 /usr/lib/ruby/vendor_ruby/did_you_mean/levenshtein.rb
   29 /usr/lib/ruby/vendor_ruby/did_you_mean/jaro_winkler.rb
   30 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkable.rb
   31 /usr/lib/ruby/2.3.0/delegate.rb
   32 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   33 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   34 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/name_error_checkers.rb
   35 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/method_name_checker.rb
   36 /usr/lib/ruby/vendor_ruby/did_you_mean/spell_checkers/null_checker.rb
   37 /usr/lib/ruby/vendor_ruby/did_you_mean/formatter.rb
   38 /usr/lib/ruby/vendor_ruby/did_you_mean.rb

* Process memory map:

00400000-00401000 r-xp 00000000 fe:00 110372                             /usr/bin/ruby2.3
00600000-00601000 r--p 00000000 fe:00 110372                             /usr/bin/ruby2.3
00601000-00602000 rw-p 00001000 fe:00 110372                             /usr/bin/ruby2.3
01524000-01919000 rw-p 00000000 00:00 0                                  [heap]
7fad9a02d000-7fad9a1cf000 r--s 00000000 fe:00 495722                     /lib/x86_64-linux-gnu/libc-2.21.so
7fad9a1cf000-7fad9aa2a000 r--s 00000000 fe:00 180861                     /usr/lib/debug/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9aa2a000-7fad9aca6000 r--s 00000000 fe:00 111894                     /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9aca6000-7fad9acbc000 r-xp 00000000 fe:00 495715                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fad9acbc000-7fad9aebb000 ---p 00016000 fe:00 495715                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fad9aebb000-7fad9aebc000 rw-p 00015000 fe:00 495715                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fad9aebc000-7fad9aec3000 r-xp 00000000 fe:00 312116                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/stringio.so
7fad9aec3000-7fad9b0c2000 ---p 00007000 fe:00 312116                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/stringio.so
7fad9b0c2000-7fad9b0c3000 r--p 00006000 fe:00 312116                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/stringio.so
7fad9b0c3000-7fad9b0c4000 rw-p 00007000 fe:00 312116                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/stringio.so
7fad9b0c4000-7fad9b0c7000 r-xp 00000000 fe:00 312583                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/trans/transdb.so
7fad9b0c7000-7fad9b2c6000 ---p 00003000 fe:00 312583                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/trans/transdb.so
7fad9b2c6000-7fad9b2c7000 r--p 00002000 fe:00 312583                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/trans/transdb.so
7fad9b2c7000-7fad9b2c8000 rw-p 00003000 fe:00 312583                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/trans/transdb.so
7fad9b2c8000-7fad9b2ca000 r-xp 00000000 fe:00 312350                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/encdb.so
7fad9b2ca000-7fad9b4c9000 ---p 00002000 fe:00 312350                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/encdb.so
7fad9b4c9000-7fad9b4ca000 r--p 00001000 fe:00 312350                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/encdb.so
7fad9b4ca000-7fad9b4cb000 rw-p 00002000 fe:00 312350                     /usr/lib/x86_64-linux-gnu/ruby/2.3.0/enc/encdb.so
7fad9b4cb000-7fad9b743000 r--p 00000000 fe:00 107144                     /usr/lib/locale/locale-archive
7fad9b743000-7fad9b8dd000 r-xp 00000000 fe:00 495722                     /lib/x86_64-linux-gnu/libc-2.21.so
7fad9b8dd000-7fad9badd000 ---p 0019a000 fe:00 495722                     /lib/x86_64-linux-gnu/libc-2.21.so
7fad9badd000-7fad9bae1000 r--p 0019a000 fe:00 495722                     /lib/x86_64-linux-gnu/libc-2.21.so
7fad9bae1000-7fad9bae3000 rw-p 0019e000 fe:00 495722                     /lib/x86_64-linux-gnu/libc-2.21.so
7fad9bae3000-7fad9bae7000 rw-p 00000000 00:00 0 
7fad9bae7000-7fad9bbeb000 r-xp 00000000 fe:00 495726                     /lib/x86_64-linux-gnu/libm-2.21.so
7fad9bbeb000-7fad9bdea000 ---p 00104000 fe:00 495726                     /lib/x86_64-linux-gnu/libm-2.21.so
7fad9bdea000-7fad9bdeb000 r--p 00103000 fe:00 495726                     /lib/x86_64-linux-gnu/libm-2.21.so
7fad9bdeb000-7fad9bdec000 rw-p 00104000 fe:00 495726                     /lib/x86_64-linux-gnu/libm-2.21.so
7fad9bdec000-7fad9bdf4000 r-xp 00000000 fe:00 495724                     /lib/x86_64-linux-gnu/libcrypt-2.21.so
7fad9bdf4000-7fad9bff3000 ---p 00008000 fe:00 495724                     /lib/x86_64-linux-gnu/libcrypt-2.21.so
7fad9bff3000-7fad9bff4000 r--p 00007000 fe:00 495724                     /lib/x86_64-linux-gnu/libcrypt-2.21.so
7fad9bff4000-7fad9bff5000 rw-p 00008000 fe:00 495724                     /lib/x86_64-linux-gnu/libcrypt-2.21.so
7fad9bff5000-7fad9c023000 rw-p 00000000 00:00 0 
7fad9c023000-7fad9c025000 r-xp 00000000 fe:00 495725                     /lib/x86_64-linux-gnu/libdl-2.21.so
7fad9c025000-7fad9c225000 ---p 00002000 fe:00 495725                     /lib/x86_64-linux-gnu/libdl-2.21.so
7fad9c225000-7fad9c226000 r--p 00002000 fe:00 495725                     /lib/x86_64-linux-gnu/libdl-2.21.so
7fad9c226000-7fad9c227000 rw-p 00003000 fe:00 495725                     /lib/x86_64-linux-gnu/libdl-2.21.so
7fad9c227000-7fad9c2a9000 r-xp 00000000 fe:00 108161                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7fad9c2a9000-7fad9c4a8000 ---p 00082000 fe:00 108161                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7fad9c4a8000-7fad9c4a9000 r--p 00081000 fe:00 108161                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7fad9c4a9000-7fad9c4aa000 rw-p 00082000 fe:00 108161                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.0
7fad9c4aa000-7fad9c4c2000 r-xp 00000000 fe:00 491924                     /lib/x86_64-linux-gnu/libpthread-2.21.so
7fad9c4c2000-7fad9c6c1000 ---p 00018000 fe:00 491924                     /lib/x86_64-linux-gnu/libpthread-2.21.so
7fad9c6c1000-7fad9c6c2000 r--p 00017000 fe:00 491924                     /lib/x86_64-linux-gnu/libpthread-2.21.so
7fad9c6c2000-7fad9c6c3000 rw-p 00018000 fe:00 491924                     /lib/x86_64-linux-gnu/libpthread-2.21.so
7fad9c6c3000-7fad9c6c7000 rw-p 00000000 00:00 0 
7fad9c6c7000-7fad9c939000 r-xp 00000000 fe:00 111894                     /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9c939000-7fad9cb39000 ---p 00272000 fe:00 111894                     /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9cb39000-7fad9cb3f000 r--p 00272000 fe:00 111894                     /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9cb3f000-7fad9cb42000 rw-p 00278000 fe:00 111894                     /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
7fad9cb42000-7fad9cb53000 rw-p 00000000 00:00 0 
7fad9cb53000-7fad9cb75000 r-xp 00000000 fe:00 491935                     /lib/x86_64-linux-gnu/ld-2.21.so
7fad9cc36000-7fad9cc57000 r--s 00000000 fe:00 491924                     /lib/x86_64-linux-gnu/libpthread-2.21.so
7fad9cc57000-7fad9cd5d000 rw-p 00000000 00:00 0 
7fad9cd6b000-7fad9cd6c000 rw-p 00000000 00:00 0 
7fad9cd6c000-7fad9cd6e000 r--s 00000000 fe:00 110372                     /usr/bin/ruby2.3
7fad9cd6e000-7fad9cd6f000 ---p 00000000 00:00 0 
7fad9cd6f000-7fad9cd74000 rw-p 00000000 00:00 0                          [stack:91915]
7fad9cd74000-7fad9cd75000 r--p 00021000 fe:00 491935                     /lib/x86_64-linux-gnu/ld-2.21.so
7fad9cd75000-7fad9cd76000 rw-p 00022000 fe:00 491935                     /lib/x86_64-linux-gnu/ld-2.21.so
7fad9cd76000-7fad9cd77000 rw-p 00000000 00:00 0 
7fff1842b000-7fff18c2a000 rw-p 00000000 00:00 0 
7fff18d2b000-7fff18d2d000 r--p 00000000 00:00 0                          [vvar]
7fff18d2d000-7fff18d2f000 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

[1]    91914 abort (core dumped)  ruby2.3 crash.rb

This is triggered by awesome_print gem test suite.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0