Project

General

Profile

Actions

Bug #17150

closed

Dumping/loading an Exception object dumps core

Added by mame (Yusuke Endoh) about 4 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
[ruby-core:99924]

Description

During debugging a random core dump of Ractor test, I found an Exception object loaded via marshal seems broken even in Ruby 2.7.

def foo
  raise
end

begin
  foo
rescue => e
  p e
  p s = Marshal.dump(e)
  p e = Marshal.load(s)
  e.backtrace_locations
end
$ ruby exc.rb
RuntimeError
"\x04\bo:\x11RuntimeError\b:\tmesg\"\x00:\abt[\aI\"\x16exc.rb:2:in `foo'\x06:\x06ETI\"\x19exc.rb:6:in `<main>'\x06;\bT:\x11bt_locations@\a"
RuntimeError
exc.rb:11: [BUG] Segmentation fault at 0x0000000000000020
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0016 e:000015 CFUNC  :backtrace_locations
c:0003 p:0062 s:0012 e:000011 RESCUE exc.rb:11
c:0002 p:0007 s:0008 E:0018c0 EVAL   exc.rb:5 [FINISH]
c:0001 p:0000 s:0003 E:0007a0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
exc.rb:5:in `<main>'
exc.rb:11:in `rescue in <main>'
exc.rb:11:in `backtrace_locations'

-- Machine register context ------------------------------------------------
 RIP: 0x0000563f66fd6589 RBP: 0x00007f0482443f68 RSP: 0x00007fff34246e70
 RAX: 0x0000563f672dbdb8 RBX: 0x0000000000000000 RCX: 0x0000000000000000
 RDX: 0x0000563f675af510 RDI: 0x0000563f672dbdb8 RSI: 0x0000000000000d21
  R8: 0x0000000000000001  R9: 0x00007fff34247040 R10: 0x0000000055550083
 R11: 0x0000000000000246 R12: 0x0000563f672ef7c8 R13: 0x0000000000000000
 R14: 0x0000563f672e0a70 R15: 0x0000563f67346eb0 EFL: 0x0000000000010206

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

* Loaded script: exc.rb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb
    5 /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
    6 /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
    7 /home/mame/local/lib/ruby/2.7.0/x86_64-linux/rbconfig.rb
    8 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/compatibility.rb
    9 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/defaults.rb
   10 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/deprecate.rb
   11 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/errors.rb
   12 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/version.rb
   13 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb
   14 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/platform.rb
   15 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/basic_specification.rb
   16 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/stub_specification.rb
   17 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/util.rb
   18 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/text.rb
   19 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/user_interaction.rb
   20 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/specification_policy.rb
   21 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/util/list.rb
   22 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb
   23 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/exceptions.rb
   24 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/bundler_version_finder.rb
   25 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/dependency.rb
   26 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb
   27 /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
   28 /home/mame/local/lib/ruby/2.7.0/monitor.rb
   29 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb
   30 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_warn.rb
   31 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems.rb
   32 /home/mame/local/lib/ruby/site_ruby/2.7.0/rubygems/path_support.rb
   33 /home/mame/local/lib/ruby/2.7.0/did_you_mean/version.rb
   34 /home/mame/local/lib/ruby/2.7.0/did_you_mean/core_ext/name_error.rb
   35 /home/mame/local/lib/ruby/2.7.0/did_you_mean/levenshtein.rb
   36 /home/mame/local/lib/ruby/2.7.0/did_you_mean/jaro_winkler.rb
   37 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checker.rb
   38 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   39 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   40 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers.rb
   41 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/method_name_checker.rb
   42 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/key_error_checker.rb
   43 /home/mame/local/lib/ruby/2.7.0/did_you_mean/spell_checkers/null_checker.rb
   44 /home/mame/local/lib/ruby/2.7.0/did_you_mean/formatters/plain_formatter.rb
   45 /home/mame/local/lib/ruby/2.7.0/did_you_mean/tree_spell_checker.rb
   46 /home/mame/local/lib/ruby/2.7.0/did_you_mean.rb

* Process memory map:

563f66dc5000-563f66dea000 r--p 00000000 08:30 91082                      /home/mame/local/bin/ruby
563f66dea000-563f67087000 r-xp 00025000 08:30 91082                      /home/mame/local/bin/ruby
563f67087000-563f6717f000 r--p 002c2000 08:30 91082                      /home/mame/local/bin/ruby
563f67180000-563f67186000 r--p 003ba000 08:30 91082                      /home/mame/local/bin/ruby
563f67186000-563f67187000 rw-p 003c0000 08:30 91082                      /home/mame/local/bin/ruby
563f67187000-563f6719e000 rw-p 00000000 00:00 0
563f67297000-563f67646000 rw-p 00000000 00:00 0                          [heap]
7f047ee94000-7f047ee95000 r--p 00000000 08:30 91136                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
7f047ee95000-7f047ee97000 r-xp 00001000 08:30 91136                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
7f047ee97000-7f047ee98000 r--p 00003000 08:30 91136                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
7f047ee98000-7f047ee99000 r--p 00003000 08:30 91136                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
7f047ee99000-7f047ee9a000 rw-p 00004000 08:30 91136                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/trans/transdb.so
7f047ee9a000-7f047ee9b000 ---p 00000000 00:00 0
7f047ee9b000-7f047ef3c000 rw-p 00000000 00:00 0
7f047ef3c000-7f047ef3d000 ---p 00000000 00:00 0
7f047ef3d000-7f047efde000 rw-p 00000000 00:00 0
7f047efde000-7f047efdf000 ---p 00000000 00:00 0
7f047efdf000-7f047f080000 rw-p 00000000 00:00 0
7f047f080000-7f047f081000 ---p 00000000 00:00 0
7f047f081000-7f047f122000 rw-p 00000000 00:00 0
7f047f122000-7f047f123000 ---p 00000000 00:00 0
7f047f123000-7f047f1c4000 rw-p 00000000 00:00 0
7f047f1c4000-7f047f1c5000 ---p 00000000 00:00 0
7f047f1c5000-7f047f266000 rw-p 00000000 00:00 0
7f047f266000-7f047f267000 ---p 00000000 00:00 0
7f047f267000-7f047f308000 rw-p 00000000 00:00 0
7f047f308000-7f047f309000 ---p 00000000 00:00 0
7f047f309000-7f047f3aa000 rw-p 00000000 00:00 0
7f047f3aa000-7f047f3ab000 ---p 00000000 00:00 0
7f047f3ab000-7f047f44c000 rw-p 00000000 00:00 0
7f047f44c000-7f047f44d000 ---p 00000000 00:00 0
7f047f44d000-7f047f4ee000 rw-p 00000000 00:00 0
7f047f4ee000-7f047f4ef000 ---p 00000000 00:00 0
7f047f4ef000-7f047f590000 rw-p 00000000 00:00 0
7f047f590000-7f047f591000 ---p 00000000 00:00 0
7f047f591000-7f047f632000 rw-p 00000000 00:00 0
7f047f632000-7f047f633000 ---p 00000000 00:00 0
7f047f633000-7f047f6d4000 rw-p 00000000 00:00 0
7f047f6d4000-7f047f6d5000 ---p 00000000 00:00 0
7f047f6d5000-7f047f776000 rw-p 00000000 00:00 0
7f047f776000-7f047f777000 ---p 00000000 00:00 0
7f047f777000-7f047f818000 rw-p 00000000 00:00 0
7f047f818000-7f047f819000 ---p 00000000 00:00 0
7f047f819000-7f047f8ba000 rw-p 00000000 00:00 0
7f047f8ba000-7f047f8bb000 ---p 00000000 00:00 0
7f047f8bb000-7f047f95c000 rw-p 00000000 00:00 0
7f047f95c000-7f047f95d000 ---p 00000000 00:00 0
7f047f95d000-7f047f9fe000 rw-p 00000000 00:00 0
7f047f9fe000-7f047f9ff000 ---p 00000000 00:00 0
7f047f9ff000-7f047faa0000 rw-p 00000000 00:00 0
7f047faa0000-7f047faa1000 ---p 00000000 00:00 0
7f047faa1000-7f047fb42000 rw-p 00000000 00:00 0
7f047fb42000-7f047fb43000 ---p 00000000 00:00 0
7f047fb43000-7f047fbe4000 rw-p 00000000 00:00 0
7f047fbe4000-7f047fbe5000 ---p 00000000 00:00 0
7f047fbe5000-7f047fc86000 rw-p 00000000 00:00 0
7f047fc86000-7f047fc87000 ---p 00000000 00:00 0
7f047fc87000-7f047fd28000 rw-p 00000000 00:00 0
7f047fd28000-7f047fd29000 ---p 00000000 00:00 0
7f047fd29000-7f047fdca000 rw-p 00000000 00:00 0
7f047fdca000-7f047fdcb000 ---p 00000000 00:00 0
7f047fdcb000-7f047fe6c000 rw-p 00000000 00:00 0
7f047fe6c000-7f047fe6d000 ---p 00000000 00:00 0
7f047fe6d000-7f047ff0e000 rw-p 00000000 00:00 0
7f047ff0e000-7f047ff0f000 ---p 00000000 00:00 0
7f047ff0f000-7f047ffb0000 rw-p 00000000 00:00 0
7f047ffb0000-7f047ffb1000 ---p 00000000 00:00 0
7f047ffb1000-7f0480052000 rw-p 00000000 00:00 0
7f0480052000-7f0480053000 ---p 00000000 00:00 0
7f0480053000-7f04800f4000 rw-p 00000000 00:00 0
7f04800f4000-7f04800f5000 ---p 00000000 00:00 0
7f04800f5000-7f0480196000 rw-p 00000000 00:00 0
7f0480196000-7f0480197000 ---p 00000000 00:00 0
7f0480197000-7f0480238000 rw-p 00000000 00:00 0
7f0480238000-7f0480239000 ---p 00000000 00:00 0
7f0480239000-7f0482445000 rw-p 00000000 00:00 0
7f0482445000-7f0482477000 r--p 00000000 08:30 2976                       /usr/lib/locale/C.UTF-8/LC_CTYPE
7f0482477000-7f048285f000 r--p 00000000 08:30 2987                       /usr/lib/locale/locale-archive
7f048285f000-7f0482864000 rw-p 00000000 00:00 0
7f0482864000-7f0482889000 r--p 00000000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482889000-7f0482a01000 r-xp 00025000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482a01000-7f0482a4b000 r--p 0019d000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482a4b000-7f0482a4c000 ---p 001e7000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482a4c000-7f0482a4f000 r--p 001e7000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482a4f000-7f0482a52000 rw-p 001ea000 08:30 11116                      /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f0482a52000-7f0482a56000 rw-p 00000000 00:00 0
7f0482a56000-7f0482a65000 r--p 00000000 08:30 11353                      /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f0482a65000-7f0482b0c000 r-xp 0000f000 08:30 11353                      /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f0482b0c000-7f0482ba3000 r--p 000b6000 08:30 11353                      /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f0482ba3000-7f0482ba4000 r--p 0014c000 08:30 11353                      /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f0482ba4000-7f0482ba5000 rw-p 0014d000 08:30 11353                      /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f0482ba5000-7f0482ba7000 r--p 00000000 08:30 11131                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f0482ba7000-7f0482bbc000 r-xp 00002000 08:30 11131                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f0482bbc000-7f0482bd6000 r--p 00017000 08:30 11131                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f0482bd6000-7f0482bd7000 r--p 00030000 08:30 11131                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f0482bd7000-7f0482bd8000 rw-p 00031000 08:30 11131                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f0482bd8000-7f0482be0000 rw-p 00000000 00:00 0
7f0482be0000-7f0482be1000 r--p 00000000 08:30 11155                      /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f0482be1000-7f0482be3000 r-xp 00001000 08:30 11155                      /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f0482be3000-7f0482be4000 r--p 00003000 08:30 11155                      /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f0482be4000-7f0482be5000 r--p 00003000 08:30 11155                      /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f0482be5000-7f0482be6000 rw-p 00004000 08:30 11155                      /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f0482be6000-7f0482be9000 r--p 00000000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482be9000-7f0482bed000 r-xp 00003000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482bed000-7f0482bee000 r--p 00007000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482bee000-7f0482bef000 ---p 00008000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482bef000-7f0482bf0000 r--p 00008000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482bf0000-7f0482bf1000 rw-p 00009000 08:30 11489                      /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f0482bf1000-7f0482bf8000 r--p 00000000 08:30 11473                      /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f0482bf8000-7f0482c09000 r-xp 00007000 08:30 11473                      /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f0482c09000-7f0482c0e000 r--p 00018000 08:30 11473                      /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f0482c0e000-7f0482c0f000 r--p 0001c000 08:30 11473                      /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f0482c0f000-7f0482c10000 rw-p 0001d000 08:30 11473                      /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f0482c10000-7f0482c14000 rw-p 00000000 00:00 0
7f0482c14000-7f0482c15000 r--p 00000000 08:30 91159                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
7f0482c15000-7f0482c16000 r-xp 00001000 08:30 91159                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
7f0482c16000-7f0482c17000 r--p 00002000 08:30 91159                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
7f0482c17000-7f0482c18000 r--p 00002000 08:30 91159                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
7f0482c18000-7f0482c19000 rw-p 00003000 08:30 91159                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/monitor.so
7f0482c19000-7f0482c1a000 r--p 00000000 08:30 91096                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
7f0482c1a000-7f0482c1b000 r-xp 00001000 08:30 91096                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
7f0482c1b000-7f0482c1c000 r--p 00002000 08:30 91096                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
7f0482c1c000-7f0482c1d000 r--p 00002000 08:30 91096                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
7f0482c1d000-7f0482c1e000 rw-p 00003000 08:30 91096                      /home/mame/local/lib/ruby/2.7.0/x86_64-linux/enc/encdb.so
7f0482c1e000-7f0482c25000 r--s 00000000 08:30 10964                      /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f0482c25000-7f0482c27000 rw-p 00000000 00:00 0
7f0482c27000-7f0482c28000 r--p 00000000 08:30 11000                      /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f0482c28000-7f0482c4b000 r-xp 00001000 08:30 11000                      /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f0482c4b000-7f0482c53000 r--p 00024000 08:30 11000                      /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f0482c54000-7f0482c55000 r--p 0002c000 08:30 11000                      /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f0482c55000-7f0482c56000 rw-p 0002d000 08:30 11000                      /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f0482c56000-7f0482c57000 rw-p 00000000 00:00 0
7fff33a4b000-7fff3424a000 rw-p 00000000 00:00 0                          [stack]
7fff3433c000-7fff3433f000 r--p 00000000 00:00 0                          [vvar]
7fff3433f000-7fff34341000 r-xp 00000000 00:00 0                          [vdso]


Aborted
Actions #1

Updated by nagachika (Tomoyuki Chikanaga) about 4 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: REQUIRED

Updated by jeremyevans0 (Jeremy Evans) almost 4 years ago

  • Status changed from Open to Closed

@mame's pull request was merged at 369cfabd5936ccb522f8e95e0f9cc65b59ea4039

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

MEMO: 369cfabd5936ccb522f8e95e0f9cc65b59ea4039 seems depend on the preceding changeset 0b81a484f3453082d28a48968a063fd907daa5b5.
0b81a484f3453082d28a48968a063fd907daa5b5 is one of the series fixes about initialization of RBasic::flags.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0