Project

General

Profile

Bug #11750

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

I found SEGV as follows. 

 ``` 
 % cat z.rb  
 def f 
   Enumerator.new {|y| 
     1000000.times { 
       yield 
       y.yield 
     } 
   } 
 end 

 def g 
   x = proc {} 
   f(&x) 
 end 

 e = g 
 e.each {} 

 % ./miniruby z.rb 
 (snip) z.rb:4: [BUG] Segmentation fault at 0x00000000000022 
 ruby 2.3.0dev (2015-11-29 trunk 52789) [x86_64-linux] 

 -- Control frame information ----------------------------------------------- 
 c:0007 p:0006 s:0018 e:000017 BLOCK    z.rb:4 [FINISH] 
 c:0006 p:---- s:0016 e:000015 CFUNC    :times 
 c:0005 p:0010 s:0013 e:000012 BLOCK    z.rb:3 [FINISH] 
 c:0004 p:---- s:0010 E:0025a0 CFUNC    :each 
 c:0003 p:---- s:0008 e:000007 CFUNC    :each 
 c:0002 p:0040 s:0005 E:002288 EVAL     z.rb:16 [FINISH] 
 c:0001 p:0000 s:0002 E:001250 (none) [FINISH] 

 -- Ruby level backtrace information ---------------------------------------- 
 z.rb:16:in `<main>' 
 z.rb:16:in `each' 
 z.rb:16:in `each' 
 z.rb:3:in `block in f' 
 z.rb:3:in `times' 
 z.rb:4:in `block (2 levels) in f' 

 -- Machine register context ------------------------------------------------ 
  RIP: 0x00007fb4a35f2dd3 RBP: 0x00007ffe47c0e740 RSP: 0x00007ffe47c0e740 
  RAX: 0x0000000000000000 RBX: 0x0000000000000001 RCX: 0x00007fb4a4137e70 
  RDX: 0x00007ffe47c0f310 RDI: 0x00007fb4a40216f0 RSI: 0x00007fb4a3427e50 
   R8: 0x00007fb4a3328071    R9: 0x0000000000000000 R10: 0x00007fb4a3328071 
  R11: 0x0000000000000001 R12: 0x00007fb4a344e340 R13: 0x00007ffe47c12b40 
  R14: 0x00007fb4a4137da0 R15: 0x00007fb4a3427e50 EFL: 0x0000000000010206 

 -- C level backtrace information ------------------------------------------- 
 /home/ruby/tst1/ruby/miniruby(rb_print_backtrace+0x19) [0x7fb4a360be2a] vm_dump.c:688 
 /home/ruby/tst1/ruby/miniruby(rb_vm_bugreport+0xb8) [0x7fb4a360c2b4] vm_dump.c:997 
 /home/ruby/tst1/ruby/miniruby(rb_bug_context+0x117) [0x7fb4a3491b7b] error.c:420 
 /home/ruby/tst1/ruby/miniruby(sigsegv+0x5e) [0x7fb4a357234a] signal.c:890 
 /lib/x86_64-linux-gnu/libpthread.so.0 [0x7fb4a2ffb8d0] 
 /home/ruby/tst1/ruby/miniruby(block_proc_is_lambda+0x1f) [0x7fb4a35f2dd3] vm_insnhelper.c:2350 
 /home/ruby/tst1/ruby/miniruby(vm_invoke_block+0xe5) [0x7fb4a35f318c] vm_insnhelper.c:2441 
 /home/ruby/tst1/ruby/miniruby(vm_exec_core+0x272c) [0x7fb4a35f603c] insns.def:1032 
 /home/ruby/tst1/ruby/miniruby(vm_exec+0xe4) [0x7fb4a36072e8] vm.c:1621 
 /home/ruby/tst1/ruby/miniruby(invoke_block+0xd2) [0x7fb4a36052e4] vm.c:900 
 /home/ruby/tst1/ruby/miniruby(invoke_block_from_c_0+0x1d2) [0x7fb4a360566a] vm.c:950 
 /home/ruby/tst1/ruby/miniruby(invoke_block_from_c_splattable+0x49) [0x7fb4a3605707] vm.c:967 
 /home/ruby/tst1/ruby/miniruby(vm_yield+0x50) [0x7fb4a3605853] vm.c:1002 
 /home/ruby/tst1/ruby/miniruby(rb_yield_0+0x27) [0x7fb4a36012f0] vm_eval.c:1007 
 /home/ruby/tst1/ruby/miniruby(rb_yield_1+0x1d) [0x7fb4a360130f] vm_eval.c:1013 
 /home/ruby/tst1/ruby/miniruby(int_dotimes+0x7a) [0x7fb4a34f7283] numeric.c:3953 
 /home/ruby/tst1/ruby/miniruby(call_cfunc_0+0x29) [0x7fb4a35f07fb] vm_insnhelper.c:1536 
 /home/ruby/tst1/ruby/miniruby(vm_call_cfunc_with_frame+0x17d) [0x7fb4a35f1270] vm_insnhelper.c:1709 
 /home/ruby/tst1/ruby/miniruby(vm_call_cfunc+0x93) [0x7fb4a35f1390] vm_insnhelper.c:1804 
 /home/ruby/tst1/ruby/miniruby(vm_call_method_each_type+0xbb) [0x7fb4a35f2207] vm_insnhelper.c:2091 
 /home/ruby/tst1/ruby/miniruby(vm_call_method+0x77) [0x7fb4a35f2894] vm_insnhelper.c:2215 
 /home/ruby/tst1/ruby/miniruby(vm_call_general+0x3b) [0x7fb4a35f2a6a] vm_insnhelper.c:2258 
 /home/ruby/tst1/ruby/miniruby(vm_exec_core+0x2302) [0x7fb4a35f5c12] insns.def:962 
 /home/ruby/tst1/ruby/miniruby(vm_exec+0xe4) [0x7fb4a36072e8] vm.c:1621 
 /home/ruby/tst1/ruby/miniruby(invoke_block+0xd2) [0x7fb4a36052e4] vm.c:900 
 /home/ruby/tst1/ruby/miniruby(invoke_block_from_c_0+0x1d2) [0x7fb4a360566a] vm.c:950 
 /home/ruby/tst1/ruby/miniruby(invoke_block_from_c_unsplattable+0x49) [0x7fb4a3605756] vm.c:975 
 /home/ruby/tst1/ruby/miniruby(vm_invoke_proc+0x147) [0x7fb4a36059fb] vm.c:1023 
 /home/ruby/tst1/ruby/miniruby(rb_vm_invoke_proc+0x7e) [0x7fb4a3605b2c] vm.c:1051 
 /home/ruby/tst1/ruby/miniruby(rb_proc_call+0x61) [0x7fb4a349f6a7] proc.c:815 
 /home/ruby/tst1/ruby/miniruby(generator_each+0x83) [0x7fb4a348dd75] enumerator.c:1292 
 /home/ruby/tst1/ruby/miniruby(call_cfunc_m1+0x2f) [0x7fb4a35f07d0] vm_insnhelper.c:1530 
 /home/ruby/tst1/ruby/miniruby(vm_call0_cfunc_with_frame+0x16f) [0x7fb4a35ff1cf] vm_eval.c:131 
 /home/ruby/tst1/ruby/miniruby(vm_call0_cfunc+0x3b) [0x7fb4a35ff2a5] vm_eval.c:148 
 /home/ruby/tst1/ruby/miniruby(vm_call0_body+0x19c) [0x7fb4a35ff443] vm_eval.c:186 
 /home/ruby/tst1/ruby/miniruby(vm_call0+0x8e) [0x7fb4a35ff05e] vm_eval.c:61 
 /home/ruby/tst1/ruby/miniruby(rb_call0+0xaa) [0x7fb4a35ffa87] vm_eval.c:351 
 /home/ruby/tst1/ruby/miniruby(rb_call+0x52) [0x7fb4a36005bf] vm_eval.c:634 
 /home/ruby/tst1/ruby/miniruby(iterate_method+0x40) [0x7fb4a3601a03] vm_eval.c:1218 
 /home/ruby/tst1/ruby/miniruby(rb_iterate0+0x165) [0x7fb4a3601846] vm_eval.c:1168 
 /home/ruby/tst1/ruby/miniruby(rb_iterate+0x67) [0x7fb4a36019bc] vm_eval.c:1200 
 /home/ruby/tst1/ruby/miniruby(rb_block_call+0x58) [0x7fb4a3601a5d] vm_eval.c:1231 
 /home/ruby/tst1/ruby/miniruby(enumerator_block_call+0xa3) [0x7fb4a348cabd] enumerator.c:431 
 /home/ruby/tst1/ruby/miniruby(enumerator_each+0xe2) [0x7fb4a348cba1] enumerator.c:490 
 /home/ruby/tst1/ruby/miniruby(call_cfunc_m1+0x2f) [0x7fb4a35f07d0] vm_insnhelper.c:1530 
 /home/ruby/tst1/ruby/miniruby(vm_call_cfunc_with_frame+0x17d) [0x7fb4a35f1270] vm_insnhelper.c:1709 
 /home/ruby/tst1/ruby/miniruby(vm_call_cfunc+0x93) [0x7fb4a35f1390] vm_insnhelper.c:1804 
 /home/ruby/tst1/ruby/miniruby(vm_call_method_each_type+0xbb) [0x7fb4a35f2207] vm_insnhelper.c:2091 
 /home/ruby/tst1/ruby/miniruby(vm_call_method+0x77) [0x7fb4a35f2894] vm_insnhelper.c:2215 
 /home/ruby/tst1/ruby/miniruby(vm_call_general+0x3b) [0x7fb4a35f2a6a] vm_insnhelper.c:2258 
 /home/ruby/tst1/ruby/miniruby(vm_exec_core+0x2302) [0x7fb4a35f5c12] insns.def:962 
 /home/ruby/tst1/ruby/miniruby(vm_exec+0xe4) [0x7fb4a36072e8] vm.c:1621 
 /home/ruby/tst1/ruby/miniruby(rb_iseq_eval_main+0x36) [0x7fb4a3607f27] vm.c:1863 
 /home/ruby/tst1/ruby/miniruby(ruby_exec_internal+0x138) [0x7fb4a3497ff0] eval.c:244 
 /home/ruby/tst1/ruby/miniruby(ruby_exec_node+0x24) [0x7fb4a3498119] eval.c:309 
 /home/ruby/tst1/ruby/miniruby(ruby_run_node+0x3e) [0x7fb4a34980ec] eval.c:301 
 /home/ruby/tst1/ruby/miniruby(main+0x71) [0x7fb4a344e4e1] main.c:36 

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

 * Loaded script: z.rb 

 * Loaded features: 

     0 enumerator.so 
     1 thread.rb 
     2 rational.so 
     3 complex.so 

 * Process memory map: 

 7fb4a1928000-7fb4a1acf000 r--s 00000000 fe:01 12714517                     /lib/x86_64-linux-gnu/libc-2.19.so 
 7fb4a1acf000-7fb4a206e000 r--s 00000000 fe:01 11815059                     /home/ruby/tst1/ruby/miniruby 
 7fb4a206e000-7fb4a2084000 r-xp 00000000 fe:01 12713988                     /lib/x86_64-linux-gnu/libgcc_s.so.1 
 7fb4a2084000-7fb4a2283000 ---p 00016000 fe:01 12713988                     /lib/x86_64-linux-gnu/libgcc_s.so.1 
 7fb4a2283000-7fb4a2284000 rw-p 00015000 fe:01 12713988                     /lib/x86_64-linux-gnu/libgcc_s.so.1 
 7fb4a2284000-7fb4a2423000 r-xp 00000000 fe:01 12714517                     /lib/x86_64-linux-gnu/libc-2.19.so 
 7fb4a2423000-7fb4a2623000 ---p 0019f000 fe:01 12714517                     /lib/x86_64-linux-gnu/libc-2.19.so 
 7fb4a2623000-7fb4a2627000 r--p 0019f000 fe:01 12714517                     /lib/x86_64-linux-gnu/libc-2.19.so 
 7fb4a2627000-7fb4a2629000 rw-p 001a3000 fe:01 12714517                     /lib/x86_64-linux-gnu/libc-2.19.so 
 7fb4a2629000-7fb4a262d000 rw-p 00000000 00:00 0  
 7fb4a262d000-7fb4a272d000 r-xp 00000000 fe:01 12716931                     /lib/x86_64-linux-gnu/libm-2.19.so 
 7fb4a272d000-7fb4a292c000 ---p 00100000 fe:01 12716931                     /lib/x86_64-linux-gnu/libm-2.19.so 
 7fb4a292c000-7fb4a292d000 r--p 000ff000 fe:01 12716931                     /lib/x86_64-linux-gnu/libm-2.19.so 
 7fb4a292d000-7fb4a292e000 rw-p 00100000 fe:01 12716931                     /lib/x86_64-linux-gnu/libm-2.19.so 
 7fb4a292e000-7fb4a2936000 r-xp 00000000 fe:01 12716929                     /lib/x86_64-linux-gnu/libcrypt-2.19.so 
 7fb4a2936000-7fb4a2b35000 ---p 00008000 fe:01 12716929                     /lib/x86_64-linux-gnu/libcrypt-2.19.so 
 7fb4a2b35000-7fb4a2b36000 r--p 00007000 fe:01 12716929                     /lib/x86_64-linux-gnu/libcrypt-2.19.so 
 7fb4a2b36000-7fb4a2b37000 rw-p 00008000 fe:01 12716929                     /lib/x86_64-linux-gnu/libcrypt-2.19.so 
 7fb4a2b37000-7fb4a2b65000 rw-p 00000000 00:00 0  
 7fb4a2b65000-7fb4a2b68000 r-xp 00000000 fe:01 12716930                     /lib/x86_64-linux-gnu/libdl-2.19.so 
 7fb4a2b68000-7fb4a2d67000 ---p 00003000 fe:01 12716930                     /lib/x86_64-linux-gnu/libdl-2.19.so 
 7fb4a2d67000-7fb4a2d68000 r--p 00002000 fe:01 12716930                     /lib/x86_64-linux-gnu/libdl-2.19.so 
 7fb4a2d68000-7fb4a2d69000 rw-p 00003000 fe:01 12716930                     /lib/x86_64-linux-gnu/libdl-2.19.so 
 7fb4a2d69000-7fb4a2dea000 r-xp 00000000 fe:01 20582598                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0 
 7fb4a2dea000-7fb4a2fea000 ---p 00081000 fe:01 20582598                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0 
 7fb4a2fea000-7fb4a2feb000 r--p 00081000 fe:01 20582598                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0 
 7fb4a2feb000-7fb4a2fec000 rw-p 00082000 fe:01 20582598                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0 
 7fb4a2fec000-7fb4a3004000 r-xp 00000000 fe:01 12714181                     /lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a3004000-7fb4a3203000 ---p 00018000 fe:01 12714181                     /lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a3203000-7fb4a3204000 r--p 00017000 fe:01 12714181                     /lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a3204000-7fb4a3205000 rw-p 00018000 fe:01 12714181                     /lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a3205000-7fb4a3209000 rw-p 00000000 00:00 0  
 7fb4a3209000-7fb4a3229000 r-xp 00000000 fe:01 12714183                     /lib/x86_64-linux-gnu/ld-2.19.so 
 7fb4a3328000-7fb4a3429000 rw-p 00000000 00:00 0  
 7fb4a3429000-7fb4a342a000 r--p 00020000 fe:01 12714183                     /lib/x86_64-linux-gnu/ld-2.19.so 
 7fb4a342a000-7fb4a342b000 rw-p 00021000 fe:01 12714183                     /lib/x86_64-linux-gnu/ld-2.19.so 
 7fb4a342b000-7fb4a342c000 rw-p 00000000 00:00 0  
 7fb4a342c000-7fb4a36f5000 r-xp 00000000 fe:01 11815059                     /home/ruby/tst1/ruby/miniruby 
 7fb4a3703000-7fb4a37a7000 r--s 00000000 fe:01 20712003                     /usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a37a7000-7fb4a37c9000 r--s 00000000 fe:01 12714181                     /lib/x86_64-linux-gnu/libpthread-2.19.so 
 7fb4a37c9000-7fb4a38d1000 r--p 00000000 fe:01 20583470                     /usr/lib/locale/locale-archive 
 7fb4a38d1000-7fb4a38d6000 rw-p 00000000 00:00 0  
 7fb4a38ed000-7fb4a38ee000 rw-p 00000000 00:00 0  
 7fb4a38ee000-7fb4a38ef000 ---p 00000000 00:00 0  
 7fb4a38ef000-7fb4a38f4000 rw-p 00000000 00:00 0                            [stack:6787] 
 7fb4a38f4000-7fb4a38fa000 rw-p 002c8000 fe:01 11815059                     /home/ruby/tst1/ruby/miniruby 
 7fb4a38fa000-7fb4a390d000 rw-p 00000000 00:00 0  
 7fb4a3ff6000-7fb4a413f000 rw-p 00000000 00:00 0                            [heap] 
 7ffe47416000-7ffe47c15000 rw-p 00000000 00:00 0  
 7ffe47d67000-7ffe47d69000 r-xp 00000000 00:00 0                            [vdso] 
 7ffe47d69000-7ffe47d6b000 r--p 00000000 00:00 0                            [vvar] 
 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 

 ``` 

Back