Project

General

Profile

Bug #3417

undef load and backtrace

Added by akr (Akira Tanaka) about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-06-08 trunk 28202) [i686-linux]
Backport:
[ruby-dev:41566]

Description

=begin
以下のようにすると SEGV します。

% cat t.rb
class C
def initialize
@a = @b = @c = @d = nil
end
end
GC.stress = true
module Kernel
undef load
end
C.new
raise
% ./ruby -ve 'load "t.rb"'
ruby 1.9.3dev (2010-06-08 trunk 28202) [i686-linux]
t.rb:11: [BUG] Segmentation fault
ruby 1.9.3dev (2010-06-08 trunk 28202) [i686-linux]

-- control frame ----------
c:0006 p:0063 s:0014 b:0014 l:000013 d:000013 TOP t.rb:11
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
zsh: segmentation fault (core dumped) ./ruby -ve 'load "t.rb"'
% RUBY_DEBUG=core ./ruby -ve 'load "t.rb"'
ruby 1.9.3dev (2010-06-08 trunk 28202) [i686-linux]
zsh: segmentation fault (core dumped) RUBY_DEBUG=core ./ruby -ve 'load "t.rb"'
% gdb ruby core.5445
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/i686/cmov/libpthread.so.0...Reading symbols
from /usr/lib/debug/lib/i686/cmov/libpthread-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/libpthread.so.0
Reading symbols from /lib/i686/cmov/librt.so.1...Reading symbols from
/usr/lib/debug/lib/i686/cmov/librt-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/librt.so.1
Reading symbols from /lib/i686/cmov/libdl.so.2...Reading symbols from
/usr/lib/debug/lib/i686/cmov/libdl-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/libdl.so.2
Reading symbols from /lib/i686/cmov/libcrypt.so.1...Reading symbols
from /usr/lib/debug/lib/i686/cmov/libcrypt-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/libcrypt.so.1
Reading symbols from /lib/i686/cmov/libm.so.6...Reading symbols from
/usr/lib/debug/lib/i686/cmov/libm-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/libm.so.6
Reading symbols from /lib/i686/cmov/libc.so.6...Reading symbols from
/usr/lib/debug/lib/i686/cmov/libc-2.7.so...done.
done.
Loaded symbols for /lib/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...Reading symbols from
/usr/lib/debug/lib/ld-2.7.so...done.
done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from
/home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/encdb.so...done.
Loaded symbols for /home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/encdb.so
Reading symbols from
/home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/euc_jp.so...done.
Loaded symbols for /home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/euc_jp.so
Reading symbols from
/home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so...done.
Loaded symbols for
/home/ruby/tcio/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
Core was generated by `./ruby -ve load "t.rb"'.
Program terminated with signal 11, Segmentation fault.
[New process 5445]
[New process 5446]
#0 0x08154da2 in vm_backtrace_each (th=0x87cb030, lev=-2,
init=0x8154dfe ,
iter=0x8154e18 , arg=0xbff27034) at vm.c:741
741 id = cfp->me->def->original_id;
(gdb) bt
#0 0x08154da2 in vm_backtrace_each (th=0x87cb030, lev=-2,
init=0x8154dfe ,
iter=0x8154e18 , arg=0xbff27034) at vm.c:741
#1 0x08154f86 in vm_backtrace (th=0x87cb030, lev=-1) at vm.c:784
#2 0x08153492 in rb_make_backtrace () at vm_eval.c:1610
#3 0x0805f194 in setup_exception (th=0x87cb030, tag=6,
mesg=142541120) at eval.c:389
#4 0x0805f81c in rb_raise_jump (mesg=4) at eval.c:589
#5 0x0805f606 in rb_f_raise (argc=0, argv=0xb7a46044) at eval.c:519
#6 0x0814d8a1 in call_cfunc (func=0x805f5c3 ,
recv=142587860, len=-1, argc=0, argv=0xb7a46044)
at vm_insnhelper.c:314
#7 0x0814d779 in vm_call_cfunc (th=0x87cb030, reg_cfp=0xb7ac5f00,
num=0, recv=142587860, blockptr=0x0, me=0x880f730)
at vm_insnhelper.c:401
#8 0x0814cd4d in vm_call_method (th=0x87cb030, cfp=0xb7ac5f00, num=0,
blockptr=0x0, flag=24, id=2752, me=0x880f730,
recv=142587860) at vm_insnhelper.c:523
#9 0x0814893a in vm_exec_core (th=0x87cb030, initial=0) at insns.def:1006
#10 0x08155b59 in vm_exec (th=0x87cb030) at vm.c:1145
#11 0x081562f9 in rb_iseq_eval (iseqval=142496180) at vm.c:1372
#12 0x081914b1 in rb_load_internal (fname=142497460, wrap=0) at load.c:302
#13 0x081916b6 in rb_f_load (argc=1, argv=0xb7a46024) at load.c:375
#14 0x0814d8a1 in call_cfunc (func=0x81915ff ,
recv=142587860, len=-1, argc=1, argv=0xb7a46024)
at vm_insnhelper.c:314
#15 0x0814d779 in vm_call_cfunc (th=0x87cb030, reg_cfp=0xb7ac5f84,
num=1, recv=142587860, blockptr=0x0, me=0x88476c8)
at vm_insnhelper.c:401
#16 0x0814cd4d in vm_call_method (th=0x87cb030, cfp=0xb7ac5f84, num=1,
blockptr=0x0, flag=8, id=5944, me=0x88476c8,
recv=142587860) at vm_insnhelper.c:523
#17 0x0814893a in vm_exec_core (th=0x87cb030, initial=0) at insns.def:1006
#18 0x08155b59 in vm_exec (th=0x87cb030) at vm.c:1145
#19 0x08156332 in rb_iseq_eval_main (iseqval=142497640) at vm.c:1386
#20 0x0805edb8 in ruby_exec_internal (n=0x87e5768) at eval.c:214
#21 0x0805eec1 in ruby_exec_node (n=0x87e5768) at eval.c:261
#22 0x0805ee95 in ruby_run_node (n=0x87e5768) at eval.c:254
#23 0x0805d908 in main (argc=3, argv=0xbff287f4) at main.c:35
(gdb)

なお、これは RUBY_DEBUG=gc_stress で
rubyspec/core/kernel/autoload_spec.rb というのから見つけたものです。
--
[田中 哲][たなか あきら][Tanaka Akira]
=end

History

#1

Updated by naruse (Yui NARUSE) almost 9 years ago

  • Status changed from Open to Closed
  • ruby -v set to ruby 1.9.3dev (2010-06-08 trunk 28202) [i686-linux]

=begin
trunk r29199 では直っているようです
=end

Also available in: Atom PDF