Issue #15427 has been updated by ko1 (Koichi Sasada).


Thank you for your report.
This issue was from Ruby 2.0 :p


----------------------------------------
Bug #15427: Assertion Failed: vm_method.c:858:prepare_callable_method_entry:callable_method_entry_p(cme)
https://bugs.ruby-lang.org/issues/15427#change-75768

* Author: osyo (manga osyo)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0dev (2018-12-17 trunk 66427) [x86_64-linux]
* Backport: 2.4: REQUIRED, 2.5: REQUIRED
----------------------------------------
以下のようなコードで Ruby(trunk) が SEGV しました。

## 再現コード

```ruby
module M1
  def bar
    "bar"
  end
end

module M2
  include M1

  # これをコメントアウトすると落ちない
  private(*M1.instance_methods(false))

  def meth
    bar
  end
end

self.extend M2

p meth
```

## ログ

```
 $ ./ruby -v
ruby 2.6.0dev (2018-12-17 trunk 66427) [x86_64-linux]
 $ cat test.rb
module M1
  def bar
    "bar"
  end
end

module M2
  include M1

  # これをコメントアウトすると落ちない
  private(*M1.instance_methods(false))

  def meth
    bar
  end
end

self.extend M2

p meth
 $ make DEFS=-DVM_CHECK_MODE=2 run
./revision.h unchanged
./miniruby -I./lib -I. -I.ext/common   ./test.rb 
Assertion Failed: vm_method.c:858:prepare_callable_method_entry:callable_method_entry_p(cme)
ruby 2.6.0dev (2018-12-17 trunk 66427) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0003 p:0004 s:0012 e:000010 METHOD ./test.rb:14
c:0002 p:0033 s:0007 e:000005 EVAL   ./test.rb:20 [FINISH]
c:0001 p:0000 s:0003 E:0018d0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
./test.rb:20:in `<main>'
./test.rb:14:in `meth'

-- C level backtrace information -------------------------------------------
/home/worker/build/ruby/ruby/miniruby(rb_vm_bugreport+0xac) [0x560d486612fc] vm_dump.c:715
/home/worker/build/ruby/ruby/miniruby(rb_assert_failure+0x72) [0x560d4848bdd2] error.c:674
/home/worker/build/ruby/ruby/miniruby(prepare_callable_method_entry+0x174) [0x560d48641944] vm_method.c:858
/home/worker/build/ruby/ruby/miniruby(rb_callable_method_entry+0x2f) [0x560d486419df] vm_method.c:874
/home/worker/build/ruby/ruby/miniruby(vm_call_method_each_type+0x439) [0x560d4864a929] vm_insnhelper.c:2123
/home/worker/build/ruby/ruby/miniruby(vm_call_method+0x142) [0x560d4864ac32] vm_insnhelper.c:2397
/home/worker/build/ruby/ruby/miniruby(vm_exec_core+0x12b) [0x560d4865124b] insns.def:763
/home/worker/build/ruby/ruby/miniruby(rb_vm_exec+0x9f) [0x560d4864787f] vm.c:1886
/home/worker/build/ruby/ruby/miniruby(ruby_exec_internal+0xd3) [0x560d48492753] eval.c:261
/home/worker/build/ruby/ruby/miniruby(ruby_exec_node+0x11) [0x560d4849725b] eval.c:325
/home/worker/build/ruby/ruby/miniruby(ruby_run_node) eval.c:317
/home/worker/build/ruby/ruby/miniruby(main+0x6f) [0x560d483fca7f] ./main.c:42

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

* Loaded script: ./test.rb

* Loaded features:

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

* Process memory map:

560d483d6000-560d48757000 r-xp 00000000 fd:00 11424864                   /home/worker/build/ruby/ruby/miniruby
560d48956000-560d4895c000 r--p 00380000 fd:00 11424864                   /home/worker/build/ruby/ruby/miniruby
560d4895c000-560d4895d000 rw-p 00386000 fd:00 11424864                   /home/worker/build/ruby/ruby/miniruby
560d4895d000-560d4896e000 rw-p 00000000 00:00 0 
560d49553000-560d49688000 rw-p 00000000 00:00 0                          [heap]
7fb36bf94000-7fb36c173000 r--s 00000000 fd:00 1704138                    /lib/x86_64-linux-gnu/libc-2.26.so
7fb36c173000-7fb36d3df000 r--s 00000000 fd:00 11424864                   /home/worker/build/ruby/ruby/miniruby
7fb36d3df000-7fb36d3f5000 r-xp 00000000 fd:00 1706029                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb36d3f5000-7fb36d5f4000 ---p 00016000 fd:00 1706029                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb36d5f4000-7fb36d5f5000 r--p 00015000 fd:00 1706029                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb36d5f5000-7fb36d5f6000 rw-p 00016000 fd:00 1706029                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb36d5f6000-7fb36f5ff000 rw-p 00000000 00:00 0 
7fb36f5ff000-7fb36f9db000 r--p 00000000 fd:00 5246337                    /usr/lib/locale/locale-archive
7fb36f9db000-7fb36fbb1000 r-xp 00000000 fd:00 1704138                    /lib/x86_64-linux-gnu/libc-2.26.so
7fb36fbb1000-7fb36fdb1000 ---p 001d6000 fd:00 1704138                    /lib/x86_64-linux-gnu/libc-2.26.so
7fb36fdb1000-7fb36fdb5000 r--p 001d6000 fd:00 1704138                    /lib/x86_64-linux-gnu/libc-2.26.so
7fb36fdb5000-7fb36fdb7000 rw-p 001da000 fd:00 1704138                    /lib/x86_64-linux-gnu/libc-2.26.so
7fb36fdb7000-7fb36fdbb000 rw-p 00000000 00:00 0 
7fb36fdbb000-7fb36ff10000 r-xp 00000000 fd:00 1704146                    /lib/x86_64-linux-gnu/libm-2.26.so
7fb36ff10000-7fb37010f000 ---p 00155000 fd:00 1704146                    /lib/x86_64-linux-gnu/libm-2.26.so
7fb37010f000-7fb370110000 r--p 00154000 fd:00 1704146                    /lib/x86_64-linux-gnu/libm-2.26.so
7fb370110000-7fb370111000 rw-p 00155000 fd:00 1704146                    /lib/x86_64-linux-gnu/libm-2.26.so
7fb370111000-7fb37011a000 r-xp 00000000 fd:00 1704142                    /lib/x86_64-linux-gnu/libcrypt-2.26.so
7fb37011a000-7fb370319000 ---p 00009000 fd:00 1704142                    /lib/x86_64-linux-gnu/libcrypt-2.26.so
7fb370319000-7fb37031a000 r--p 00008000 fd:00 1704142                    /lib/x86_64-linux-gnu/libcrypt-2.26.so
7fb37031a000-7fb37031b000 rw-p 00009000 fd:00 1704142                    /lib/x86_64-linux-gnu/libcrypt-2.26.so
7fb37031b000-7fb370349000 rw-p 00000000 00:00 0 
7fb370349000-7fb37034c000 r-xp 00000000 fd:00 1704144                    /lib/x86_64-linux-gnu/libdl-2.26.so
7fb37034c000-7fb37054b000 ---p 00003000 fd:00 1704144                    /lib/x86_64-linux-gnu/libdl-2.26.so
7fb37054b000-7fb37054c000 r--p 00002000 fd:00 1704144                    /lib/x86_64-linux-gnu/libdl-2.26.so
7fb37054c000-7fb37054d000 rw-p 00003000 fd:00 1704144                    /lib/x86_64-linux-gnu/libdl-2.26.so
7fb37054d000-7fb370554000 r-xp 00000000 fd:00 1704195                    /lib/x86_64-linux-gnu/librt-2.26.so
7fb370554000-7fb370753000 ---p 00007000 fd:00 1704195                    /lib/x86_64-linux-gnu/librt-2.26.so
7fb370753000-7fb370754000 r--p 00006000 fd:00 1704195                    /lib/x86_64-linux-gnu/librt-2.26.so
7fb370754000-7fb370755000 rw-p 00007000 fd:00 1704195                    /lib/x86_64-linux-gnu/librt-2.26.so
7fb370755000-7fb37076f000 r-xp 00000000 fd:00 1704193                    /lib/x86_64-linux-gnu/libpthread-2.26.so
7fb37076f000-7fb37096e000 ---p 0001a000 fd:00 1704193                    /lib/x86_64-linux-gnu/libpthread-2.26.so
7fb37096e000-7fb37096f000 r--p 00019000 fd:00 1704193                    /lib/x86_64-linux-gnu/libpthread-2.26.so
7fb37096f000-7fb370970000 rw-p 0001a000 fd:00 1704193                    /lib/x86_64-linux-gnu/libpthread-2.26.so
7fb370970000-7fb370974000 rw-p 00000000 00:00 0 
7fb370974000-7fb370990000 r-xp 00000000 fd:00 1704018                    /lib/x86_64-linux-gnu/libz.so.1.2.11
7fb370990000-7fb370b8f000 ---p 0001c000 fd:00 1704018                    /lib/x86_64-linux-gnu/libz.so.1.2.11
7fb370b8f000-7fb370b90000 r--p 0001b000 fd:00 1704018                    /lib/x86_64-linux-gnu/libz.so.1.2.11
7fb370b90000-7fb370b91000 rw-p 0001c000 fd:00 1704018                    /lib/x86_64-linux-gnu/libz.so.1.2.11
7fb370b91000-7fb370bb8000 r-xp 00000000 fd:00 1704130                    /lib/x86_64-linux-gnu/ld-2.26.so
7fb370c7c000-7fb370d84000 rw-p 00000000 00:00 0 
7fb370db1000-7fb370db8000 r--s 00000000 fd:00 5511606                    /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fb370db8000-7fb370db9000 r--p 00027000 fd:00 1704130                    /lib/x86_64-linux-gnu/ld-2.26.so
7fb370db9000-7fb370dba000 rw-p 00028000 fd:00 1704130                    /lib/x86_64-linux-gnu/ld-2.26.so
7fb370dba000-7fb370dbb000 rw-p 00000000 00:00 0 
7ffd1fb25000-7ffd20324000 rw-p 00000000 00:00 0                          [stack]
7ffd2039b000-7ffd2039e000 r--p 00000000 00:00 0                          [vvar]
7ffd2039e000-7ffd203a0000 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: https://www.ruby-lang.org/bugreport.html

uncommon.mk:1140: ターゲット 'run' のレシピで失敗しました
make: *** [run] 中止 (コアダンプしました)
```

## 再現した Ruby のコミット

* b824c871174fc33519ce5344a8f08cbbc3980d62





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>