From: shugo@... Date: 2016-07-07T11:07:48+00:00 Subject: [ruby-core:76289] [Ruby trunk Bug#12565] SEGV when using &:foo with tail call optimization Issue #12565 has been updated by Shugo Maeda. The debug information is as follows: ``` (eval):2: [BUG] Segmentation fault at 0x00000000000010 ruby 2.4.0dev (2016-07-07 trunk 55604) [x86_64-linux] -- Control frame information ----------------------------------------------- c:0006 p:---- s:0019 e:000018 IFUNC :foo c:0005 p:0005 s:0017 e:000014 METHOD (eval):2 c:0004 p:0025 s:0011 e:000009 EVAL (eval):9 [FINISH] c:0003 p:---- s:0008 e:000007 CFUNC :eval c:0002 p:0033 s:0004 E:0018e0 EVAL t/t.rb:6 [FINISH] c:0001 p:0000 s:0002 E:0001f0 (none) [FINISH] -- Ruby level backtrace information ---------------------------------------- t/t.rb:6:in `
' t/t.rb:6:in `eval' (eval):9:in `
' (eval):2:in `foo' -- Machine register context ------------------------------------------------ RIP: 0x00007fb460b17971 RBP: 0x00007ffdbdbfb7b0 RSP: 0x00007ffdbdbfb720 RAX: 0x0000000000000000 RBX: 0x00007ffdbdbfca70 RCX: 0x00007fb4617f63a0 RDX: 0x00007fb460d590a8 RDI: 0x00007fb461792600 RSI: 0x0000000000000000 R8: 0x00007fb460d59081 R9: 0x0000000000000000 R10: 0x0000000000000011 R11: 0x00007fb460e58ef3 R12: 0x00007fb4609c3f60 R13: 0x00007ffdbdbfe100 R14: 0x00007fb461b718b8 R15: 0x00007fb460e58ed0 EFL: 0x0000000000010246 -- C level backtrace information ------------------------------------------- /home/shugo/src/ruby/ruby(rb_print_backtrace+0x19) [0x7fb460b33c77] vm_dump.c:688 /home/shugo/src/ruby/ruby(rb_vm_bugreport+0xb8) [0x7fb460b340fe] vm_dump.c:997 /home/shugo/src/ruby/ruby(rb_bug_context+0x117) [0x7fb460ba2ba0] error.c:408 /home/shugo/src/ruby/ruby(sigsegv+0x5b) [0x7fb460aafa7c] signal.c:896 /lib/x86_64-linux-gnu/libpthread.so.0 [0x7fb46056e330] /home/shugo/src/ruby/ruby(vm_yield_with_cfunc+0x21b) [0x7fb460b17971] vm_insnhelper.c:2337 /home/shugo/src/ruby/ruby(vm_invoke_block+0x2c4) [0x7fb460b180b1] vm_insnhelper.c:2469 /home/shugo/src/ruby/ruby(vm_exec_core+0x2f4f) [0x7fb460b1b5cb] insns.def:1103 /home/shugo/src/ruby/ruby(vm_exec+0xe7) [0x7fb460b2c546] vm.c:1653 /home/shugo/src/ruby/ruby(eval_string_with_cref+0x4ca) [0x7fb460b2736d] vm_eval.c:1387 /home/shugo/src/ruby/ruby(eval_string+0x42) [0x7fb460b2742a] vm_eval.c:1403 /home/shugo/src/ruby/ruby(rb_f_eval+0xc8) [0x7fb460b274f4] vm_eval.c:1442 /home/shugo/src/ruby/ruby(call_cfunc_m1+0x2f) [0x7fb460b150d7] vm_insnhelper.c:1462 /home/shugo/src/ruby/ruby(vm_call_cfunc_with_frame+0x18d) [0x7fb460b15bfd] vm_insnhelper.c:1641 /home/shugo/src/ruby/ruby(vm_call_cfunc+0x93) [0x7fb460b15d1a] vm_insnhelper.c:1736 /home/shugo/src/ruby/ruby(vm_call_method_each_type+0xbb) [0x7fb460b16b71] vm_insnhelper.c:2028 /home/shugo/src/ruby/ruby(vm_call_method+0xff) [0x7fb460b17297] vm_insnhelper.c:2163 /home/shugo/src/ruby/ruby(vm_call_general+0x3b) [0x7fb460b173e5] vm_insnhelper.c:2195 /home/shugo/src/ruby/ruby(vm_exec_core+0x2d1a) [0x7fb460b1b396] insns.def:1064 /home/shugo/src/ruby/ruby(vm_exec+0xe7) [0x7fb460b2c546] vm.c:1653 /home/shugo/src/ruby/ruby(rb_iseq_eval_main+0x36) [0x7fb460b2d198] vm.c:1896 /home/shugo/src/ruby/ruby(ruby_exec_internal+0x12c) [0x7fb4609c641b] eval.c:244 /home/shugo/src/ruby/ruby(ruby_exec_node+0x24) [0x7fb4609c6544] eval.c:308 /home/shugo/src/ruby/ruby(ruby_run_node+0x3e) [0x7fb4609c6517] eval.c:300 /home/shugo/src/ruby/ruby(main+0x5d) [0x7fb4609c40d2] main.c:36 -- Other runtime information ----------------------------------------------- * Loaded script: t/t.rb * Loaded features: 0 enumerator.so 1 thread.rb 2 rational.so 3 complex.so 4 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so 5 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so 6 /home/shugo/local/lib/ruby/2.4.0/unicode_normalize.rb 7 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/rbconfig.rb 8 /home/shugo/local/lib/ruby/2.4.0/rubygems/compatibility.rb 9 /home/shugo/local/lib/ruby/2.4.0/rubygems/defaults.rb 10 /home/shugo/local/lib/ruby/2.4.0/rubygems/deprecate.rb 11 /home/shugo/local/lib/ruby/2.4.0/rubygems/errors.rb 12 /home/shugo/local/lib/ruby/2.4.0/rubygems/version.rb 13 /home/shugo/local/lib/ruby/2.4.0/rubygems/requirement.rb 14 /home/shugo/local/lib/ruby/2.4.0/rubygems/platform.rb 15 /home/shugo/local/lib/ruby/2.4.0/rubygems/basic_specification.rb 16 /home/shugo/local/lib/ruby/2.4.0/rubygems/stub_specification.rb 17 /home/shugo/local/lib/ruby/2.4.0/rubygems/util/list.rb 18 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/stringio.so 19 /home/shugo/local/lib/ruby/2.4.0/rubygems/specification.rb 20 /home/shugo/local/lib/ruby/2.4.0/rubygems/exceptions.rb 21 /home/shugo/local/lib/ruby/2.4.0/rubygems/dependency.rb 22 /home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb 23 /home/shugo/local/lib/ruby/2.4.0/monitor.rb 24 /home/shugo/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb 25 /home/shugo/local/lib/ruby/2.4.0/rubygems.rb 26 /home/shugo/local/lib/ruby/2.4.0/rubygems/path_support.rb 27 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/version.rb 28 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/core_ext/name_error.rb 29 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/levenshtein.rb 30 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/jaro_winkler.rb 31 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkable.rb 32 /home/shugo/local/lib/ruby/2.4.0/delegate.rb 33 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb 34 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb 35 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers.rb 36 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/method_name_checker.rb 37 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/null_checker.rb 38 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean/formatter.rb 39 /home/shugo/local/lib/ruby/gems/2.4.0/gems/did_you_mean-1.0.0/lib/did_you_mean.rb * Process memory map: 7fb45e218000-7fb45e7ec000 r--s 00000000 fc:00 3299429 /home/shugo/src/ruby/ruby 7fb45e7ec000-7fb45e802000 r-xp 00000000 fc:00 131252 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fb45e802000-7fb45ea01000 ---p 00016000 fc:00 131252 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fb45ea01000-7fb45ea02000 rw-p 00015000 fc:00 131252 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fb45ea02000-7fb45ea0a000 r-xp 00000000 fc:00 4326330 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/stringio.so 7fb45ea0a000-7fb45ec09000 ---p 00008000 fc:00 4326330 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/stringio.so 7fb45ec09000-7fb45ec0a000 r--p 00007000 fc:00 4326330 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/stringio.so 7fb45ec0a000-7fb45ec0b000 rw-p 00008000 fc:00 4326330 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/stringio.so 7fb45ec0b000-7fb45ec0e000 r-xp 00000000 fc:00 4326261 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so 7fb45ec0e000-7fb45ee0d000 ---p 00003000 fc:00 4326261 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so 7fb45ee0d000-7fb45ee0e000 r--p 00002000 fc:00 4326261 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so 7fb45ee0e000-7fb45ee0f000 rw-p 00003000 fc:00 4326261 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so 7fb45ee0f000-7fb45ee11000 r-xp 00000000 fc:00 4326283 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so 7fb45ee11000-7fb45f010000 ---p 00002000 fc:00 4326283 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so 7fb45f010000-7fb45f011000 r--p 00001000 fc:00 4326283 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so 7fb45f011000-7fb45f012000 rw-p 00002000 fc:00 4326283 /home/shugo/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so 7fb45f012000-7fb45f7e2000 r--p 00000000 fc:00 6560725 /usr/lib/locale/locale-archive 7fb45f7e2000-7fb45f99c000 r-xp 00000000 fc:00 131283 /lib/x86_64-linux-gnu/libc-2.19.so 7fb45f99c000-7fb45fb9c000 ---p 001ba000 fc:00 131283 /lib/x86_64-linux-gnu/libc-2.19.so 7fb45fb9c000-7fb45fba0000 r--p 001ba000 fc:00 131283 /lib/x86_64-linux-gnu/libc-2.19.so 7fb45fba0000-7fb45fba2000 rw-p 001be000 fc:00 131283 /lib/x86_64-linux-gnu/libc-2.19.so 7fb45fba2000-7fb45fba7000 rw-p 00000000 00:00 0 7fb45fba7000-7fb45fcac000 r-xp 00000000 fc:00 131268 /lib/x86_64-linux-gnu/libm-2.19.so 7fb45fcac000-7fb45feab000 ---p 00105000 fc:00 131268 /lib/x86_64-linux-gnu/libm-2.19.so 7fb45feab000-7fb45feac000 r--p 00104000 fc:00 131268 /lib/x86_64-linux-gnu/libm-2.19.so 7fb45feac000-7fb45fead000 rw-p 00105000 fc:00 131268 /lib/x86_64-linux-gnu/libm-2.19.so 7fb45fead000-7fb45feb6000 r-xp 00000000 fc:00 131271 /lib/x86_64-linux-gnu/libcrypt-2.19.so 7fb45feb6000-7fb4600b6000 ---p 00009000 fc:00 131271 /lib/x86_64-linux-gnu/libcrypt-2.19.so 7fb4600b6000-7fb4600b7000 r--p 00009000 fc:00 131271 /lib/x86_64-linux-gnu/libcrypt-2.19.so 7fb4600b7000-7fb4600b8000 rw-p 0000a000 fc:00 131271 /lib/x86_64-linux-gnu/libcrypt-2.19.so 7fb4600b8000-7fb4600e6000 rw-p 00000000 00:00 0 7fb4600e6000-7fb4600e9000 r-xp 00000000 fc:00 131270 /lib/x86_64-linux-gnu/libdl-2.19.so 7fb4600e9000-7fb4602e8000 ---p 00003000 fc:00 131270 /lib/x86_64-linux-gnu/libdl-2.19.so 7fb4602e8000-7fb4602e9000 r--p 00002000 fc:00 131270 /lib/x86_64-linux-gnu/libdl-2.19.so 7fb4602e9000-7fb4602ea000 rw-p 00003000 fc:00 131270 /lib/x86_64-linux-gnu/libdl-2.19.so 7fb4602ea000-7fb460356000 r-xp 00000000 fc:00 6562301 /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 7fb460356000-7fb460555000 ---p 0006c000 fc:00 6562301 /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 7fb460555000-7fb460556000 r--p 0006b000 fc:00 6562301 /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 7fb460556000-7fb46055e000 rw-p 0006c000 fc:00 6562301 /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 7fb46055e000-7fb460577000 r-xp 00000000 fc:00 131275 /lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460577000-7fb460776000 ---p 00019000 fc:00 131275 /lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460776000-7fb460777000 r--p 00018000 fc:00 131275 /lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460777000-7fb460778000 rw-p 00019000 fc:00 131275 /lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460778000-7fb46077c000 rw-p 00000000 00:00 0 7fb46077c000-7fb46079f000 r-xp 00000000 fc:00 131276 /lib/x86_64-linux-gnu/ld-2.19.so 7fb4607dc000-7fb46099e000 r--s 00000000 fc:00 131283 /lib/x86_64-linux-gnu/libc-2.19.so 7fb46099e000-7fb46099f000 r--p 00022000 fc:00 131276 /lib/x86_64-linux-gnu/ld-2.19.so 7fb46099f000-7fb4609a0000 rw-p 00023000 fc:00 131276 /lib/x86_64-linux-gnu/ld-2.19.so 7fb4609a0000-7fb4609a1000 rw-p 00000000 00:00 0 7fb4609a1000-7fb460c84000 r-xp 00000000 fc:00 3299429 /home/shugo/src/ruby/ruby 7fb460c8f000-7fb460d36000 r--s 00000000 fc:00 6562986 /usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460d36000-7fb460d59000 r--s 00000000 fc:00 131275 /lib/x86_64-linux-gnu/libpthread-2.19.so 7fb460d59000-7fb460e5f000 rw-p 00000000 00:00 0 7fb460e7c000-7fb460e7d000 rw-p 00000000 00:00 0 7fb460e7d000-7fb460e7e000 ---p 00000000 00:00 0 7fb460e7e000-7fb460e83000 rw-p 00000000 00:00 0 [stack:5700] 7fb460e83000-7fb460e88000 r--p 002e2000 fc:00 3299429 /home/shugo/src/ruby/ruby 7fb460e88000-7fb460e8a000 rw-p 002e7000 fc:00 3299429 /home/shugo/src/ruby/ruby 7fb460e8a000-7fb460e9d000 rw-p 00000000 00:00 0 7fb461791000-7fb461b92000 rw-p 00000000 00:00 0 [heap] 7ffdbd401000-7ffdbdc00000 rw-p 00000000 00:00 0 7ffdbdc73000-7ffdbdc75000 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 ``` ---------------------------------------- Bug #12565: SEGV when using &:foo with tail call optimization https://bugs.ruby-lang.org/issues/12565#change-59531 * Author: Shugo Maeda * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- The following script causes SEGV: ```ruby RubyVM::InstructionSequence.compile_option = { :tailcall_optimization => true, :trace_instruction => false } eval(<