Project

General

Profile

Actions

Bug #13227

closed

Crash when refine subclass method and call super

Added by chloerei (Rei Huang) about 7 years ago. Updated about 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[ruby-core:79588]

Description

Test script:

test.rb

class Parent
end

class Child < Parent
end

module FooBar 
  refine Parent do
    def to_s
      "Parent"
    end
  end

  refine Child do
    def to_s
      super + " -> Child"
    end
  end
end

using FooBar

puts Child.new.to_s

Expect output "Parent -> Child", works in 2.3.3p222, crashed in 2.4.0p0.

Crash log:

/app/test.rb:16: [BUG] Segmentation fault at 0x00000000000008
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0003 p:0010 s:0012 e:000010 METHOD /app/test.rb:16
c:0002 p:0066 s:0007 e:000005 EVAL   /app/test.rb:23 [FINISH]
c:0001 p:0000 s:0003 E:000de0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/app/test.rb:23:in `<main>'
/app/test.rb:16:in `to_s'

-- Machine register context ------------------------------------------------
 RIP: 0x00007f34dfa59734 RBP: 0x00007f34dff69f80 RSP: 0x00007ffdf5b20d10
 RAX: 0x0000000000000000 RBX: 0x0000000000ce16c0 RCX: 0x0000000001085af0
 RDX: 0x0000000000ee7d48 RDI: 0x0000000000ee8130 RSI: 0x0000000000000ce1
  R8: 0x0000000001084f30  R9: 0x0000000000000004 R10: 0x0000000001083e50
 R11: 0x00007f34dff69fb0 R12: 0x00007ffdf5b20e70 R13: 0x0000000000000ce1
 R14: 0x0000000001085aa0 R15: 0x00007f34dff69f80 EFL: 0x0000000000010246

-- C level backtrace information -------------------------------------------
/usr/local/lib/libruby.so.2.4(rb_vm_bugreport+0x4f3) [0x7f34dfa66313] vm_dump.c:679
/usr/local/lib/libruby.so.2.4(rb_bug_context+0xd4) [0x7f34df8e75d4] error.c:426
/usr/local/lib/libruby.so.2.4(sigsegv+0x3e) [0x7f34df9da4ce] signal.c:907
/lib/x86_64-linux-gnu/libpthread.so.0 [0x7f34df634890]
/usr/local/lib/libruby.so.2.4(vm_call_zsuper+0xa4) [0x7f34dfa59734] vm_insnhelper.c:2114
/usr/local/lib/libruby.so.2.4(vm_call_method+0xe3) [0x7f34dfa58f03] vm_insnhelper.c:2291
/usr/local/lib/libruby.so.2.4(vm_exec_core+0x1931) [0x7f34dfa51d91] insns.def:1086
/usr/local/lib/libruby.so.2.4(vm_exec+0x8b) [0x7f34dfa56aab] vm.c:1712
/usr/local/lib/libruby.so.2.4(ruby_exec_internal+0xb2) [0x7f34df8ed3b2] eval.c:244
/usr/local/lib/libruby.so.2.4(ruby_exec_node+0x1d) [0x7f34df8ef0dd] eval.c:308
/usr/local/lib/libruby.so.2.4(ruby_run_node+0x1e) [0x7f34df8f1c4e] eval.c:300
/usr/local/bin/ruby(main+0x4b) [0x40087b] main.c:36

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

* Loaded script: /app/test.rb

* Loaded features:

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

* Process memory map:

00400000-00401000 r-xp 00000000 08:01 528047                             /usr/local/bin/ruby
00600000-00601000 rw-p 00000000 08:01 528047                             /usr/local/bin/ruby
00ce1000-0109f000 rw-p 00000000 00:00 0                                  [heap]
7f34dd287000-7f34dd430000 r--s 00000000 08:01 3933095                    /lib/x86_64-linux-gnu/libc-2.19.so
7f34dd430000-7f34de31b000 r--s 00000000 08:01 528085                     /usr/local/lib/libruby.so.2.4.0
7f34de31b000-7f34de331000 r-xp 00000000 08:01 3933114                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f34de331000-7f34de530000 ---p 00016000 08:01 3933114                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f34de530000-7f34de531000 rw-p 00015000 08:01 3933114                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f34de531000-7f34de539000 r-xp 00000000 08:01 655625                     /usr/local/lib/ruby/2.4.0/x86_64-linux/stringio.so
7f34de539000-7f34de738000 ---p 00008000 08:01 655625                     /usr/local/lib/ruby/2.4.0/x86_64-linux/stringio.so
7f34de738000-7f34de739000 rw-p 00007000 08:01 655625                     /usr/local/lib/ruby/2.4.0/x86_64-linux/stringio.so
7f34de739000-7f34de73c000 r-xp 00000000 08:01 655580                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so
7f34de73c000-7f34de93b000 ---p 00003000 08:01 655580                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so
7f34de93b000-7f34de93c000 rw-p 00002000 08:01 655580                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so
7f34de93c000-7f34de93e000 r-xp 00000000 08:01 655537                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so
7f34de93e000-7f34deb3d000 ---p 00002000 08:01 655537                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so
7f34deb3d000-7f34deb3e000 rw-p 00001000 08:01 655537                     /usr/local/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so
7f34deb3e000-7f34decdf000 r-xp 00000000 08:01 3933095                    /lib/x86_64-linux-gnu/libc-2.19.so
7f34decdf000-7f34deedf000 ---p 001a1000 08:01 3933095                    /lib/x86_64-linux-gnu/libc-2.19.so
7f34deedf000-7f34deee3000 r--p 001a1000 08:01 3933095                    /lib/x86_64-linux-gnu/libc-2.19.so
7f34deee3000-7f34deee5000 rw-p 001a5000 08:01 3933095                    /lib/x86_64-linux-gnu/libc-2.19.so
7f34deee5000-7f34deee9000 rw-p 00000000 00:00 0 
7f34deee9000-7f34defe9000 r-xp 00000000 08:01 3933125                    /lib/x86_64-linux-gnu/libm-2.19.so
7f34defe9000-7f34df1e8000 ---p 00100000 08:01 3933125                    /lib/x86_64-linux-gnu/libm-2.19.so
7f34df1e8000-7f34df1e9000 r--p 000ff000 08:01 3933125                    /lib/x86_64-linux-gnu/libm-2.19.so
7f34df1e9000-7f34df1ea000 rw-p 00100000 08:01 3933125                    /lib/x86_64-linux-gnu/libm-2.19.so
7f34df1ea000-7f34df1f2000 r-xp 00000000 08:01 3933103                    /lib/x86_64-linux-gnu/libcrypt-2.19.so
7f34df1f2000-7f34df3f1000 ---p 00008000 08:01 3933103                    /lib/x86_64-linux-gnu/libcrypt-2.19.so
7f34df3f1000-7f34df3f2000 r--p 00007000 08:01 3933103                    /lib/x86_64-linux-gnu/libcrypt-2.19.so
7f34df3f2000-7f34df3f3000 rw-p 00008000 08:01 3933103                    /lib/x86_64-linux-gnu/libcrypt-2.19.so
7f34df3f3000-7f34df421000 rw-p 00000000 00:00 0 
7f34df421000-7f34df424000 r-xp 00000000 08:01 3933108                    /lib/x86_64-linux-gnu/libdl-2.19.so
7f34df424000-7f34df623000 ---p 00003000 08:01 3933108                    /lib/x86_64-linux-gnu/libdl-2.19.so
7f34df623000-7f34df624000 r--p 00002000 08:01 3933108                    /lib/x86_64-linux-gnu/libdl-2.19.so
7f34df624000-7f34df625000 rw-p 00003000 08:01 3933108                    /lib/x86_64-linux-gnu/libdl-2.19.so
7f34df625000-7f34df63d000 r-xp 00000000 08:01 3933159                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7f34df63d000-7f34df83c000 ---p 00018000 08:01 3933159                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7f34df83c000-7f34df83d000 r--p 00017000 08:01 3933159                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7f34df83d000-7f34df83e000 rw-p 00018000 08:01 3933159                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7f34df83e000-7f34df842000 rw-p 00000000 00:00 0 
7f34df842000-7f34dfb41000 r-xp 00000000 08:01 528085                     /usr/local/lib/libruby.so.2.4.0
7f34dfb41000-7f34dfd40000 ---p 002ff000 08:01 528085                     /usr/local/lib/libruby.so.2.4.0
7f34dfd40000-7f34dfd49000 rw-p 002fe000 08:01 528085                     /usr/local/lib/libruby.so.2.4.0
7f34dfd49000-7f34dfd5a000 rw-p 00000000 00:00 0 
7f34dfd5a000-7f34dfd7a000 r-xp 00000000 08:01 3933077                    /lib/x86_64-linux-gnu/ld-2.19.so
7f34dfdf3000-7f34dfe15000 r--s 00000000 08:01 3933159                    /lib/x86_64-linux-gnu/libpthread-2.19.so
7f34dfe15000-7f34dfe39000 r--s 00000000 08:01 528047                     /usr/local/bin/ruby
7f34dfe39000-7f34dff70000 rw-p 00000000 00:00 0 
7f34dff73000-7f34dff74000 rw-p 00000000 00:00 0 
7f34dff74000-7f34dff75000 ---p 00000000 00:00 0 
7f34dff75000-7f34dff7a000 rw-p 00000000 00:00 0 
7f34dff7a000-7f34dff7b000 r--p 00020000 08:01 3933077                    /lib/x86_64-linux-gnu/ld-2.19.so
7f34dff7b000-7f34dff7c000 rw-p 00021000 08:01 3933077                    /lib/x86_64-linux-gnu/ld-2.19.so
7f34dff7c000-7f34dff7d000 rw-p 00000000 00:00 0 
7ffdf5323000-7ffdf5b22000 rw-p 00000000 00:00 0                          [stack]
7ffdf5b46000-7ffdf5b48000 r--p 00000000 00:00 0                          [vvar]
7ffdf5b48000-7ffdf5b4a000 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
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

  • Status changed from Open to Closed

Applied in changeset r57655.


vm_insnhelper.c: super to module in refinement

  • vm_insnhelper.c (vm_call_zsuper): method defined in module in
    refinement is not callable as-is. dispatch again.
    [ruby-core:79588] [Bug #13227]

Updated by nagachika (Tomoyuki Chikanaga) about 7 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: DONTNEED, 2.4: REQUIRED

Updated by naruse (Yui NARUSE) about 7 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: UNKNOWN, 2.3: DONTNEED, 2.4: DONE

ruby_2_4 r57907 merged revision(s) 57655.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0