yarv-dev:1104
From: Tadashi Saito <shiba mail2.accsnet.ne.jp>
Date: Thu, 9 Nov 2006 20:42:27 +0900
Subject: [yarv-dev:1104] long method-chain causes segv
こんばんは。斎藤と申します。
ええと、暗黒面をもう一つ。
たしかクラック前のruby-lang.orgバグトラッカーに登録したのですが、「少な
くともVMが変わらないと解決できません」とまつもとさんに言われたものです。
以下のようにして、10万回ひたすらメソッドをチェーンさせるスクリプトを生成
して
$ ruby -e 'puts "a=nil; def a.a; self; end"; (10**5).times{puts "a."};
puts "a"' >long_chain.rb
動かすと
$ ruby-yarv -v long_chain.rb
ruby 1.9.0 (Base: Ruby 1.9.0 2006-11-06) [i686-linux]
YARVCore 0.4.1 Rev: 578 (2006-11-09) [opts: [direct threaded code]
[inline method cache] ]
セグメンテーション違反です (core dumped)
落ちます。
$ gdb ruby-yarv
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details. This GDB was configured as "i386-linux"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) run long_chain.rb
Starting program: /usr/local/bin/ruby-yarv long_chain.rb
[Thread debugging using libthread_db enabled]
[New Thread 1076622432 (LWP 7936)]
[New Thread 1076640688 (LWP 7939)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1076622432 (LWP 7936)]
iseq_compile_each (iseq=0x80c0160, ret=0xbf800310, node=0x40548f2c,
poped=0) at ../compile.c:2480
2480 {
(gdb) l
2475 node: Ruby compiled node
2476 poped: This node will be poped
2477 */
2478 static int
2479 iseq_compile_each(yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE *
node, int poped)
2480 {
2481 VALUE tmp; /* reserved for macro */
2482 int type;
2483
2484 GC_CHECK();
(gdb) q
The program is running. Exit anyway? (y or n) y
$ gdb ruby-yarv
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details. This GDB was configured as "i386-linux"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) run long_chain.rb
Starting program: /usr/local/bin/ruby-yarv long_chain.rb
[Thread debugging using libthread_db enabled]
[New Thread 1076622432 (LWP 7945)]
[New Thread 1076640688 (LWP 7948)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1076622432 (LWP 7945)]
iseq_compile_each (iseq=0x80c0160, ret=0xbf800310, node=0x40548f2c,
poped=0) at ../compile.c:2480
2480 {
(gdb) l
2475 node: Ruby compiled node
2476 poped: This node will be poped
2477 */
2478 static int
2479 iseq_compile_each(yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE *
node, int poped) 2480 {
2481 VALUE tmp; /* reserved for macro */
2482 int type;
2483
2484 GC_CHECK();
(gdb) bt
#0 iseq_compile_each (iseq=0x80c0160, ret=0xbf800310, node=0x40548f2c,
poped=0) at ../compile.c:2480
#1 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf800630,
node=0x40548eb4, poped=0) at ../compile.c:3473
#2 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf800950,
node=0x40548e14, poped=0) at ../compile.c:3473
#3 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf800c70,
node=0x40548d9c, poped=0) at ../compile.c:3473
#4 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf800f90,
node=0x40548d10, poped=0) at ../compile.c:3473
#5 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8012b0,
node=0x40548c98, poped=0) at ../compile.c:3473
#6 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8015d0,
node=0x40548bf8, poped=0) at ../compile.c:3473
#7 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8018f0,
node=0x40548b80, poped=0) at ../compile.c:3473
#8 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf801c10,
node=0x40548af4, poped=0) at ../compile.c:3473
#9 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf801f30,
node=0x40548a7c, poped=0) at ../compile.c:3473
#10 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf802250,
node=0x405489dc, poped=0) at ../compile.c:3473
#11 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf802570,
---Type <return> to continue, or q <return> to quit---q
node=0x4054Quit
) at ../compile.c:3473
#12 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf802890,
node=0x405488d8, poped=0) at ../compile.c:3473
#13 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf802bb0,
node=0x40548860, poped=0) at ../compile.c:3473
#14 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf802ed0,
node=0x405487c0, poped=0) at ../compile.c:3473
#15 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8031f0,
node=0x40548748, poped=0) at ../compile.c:3473
#16 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf803510,
node=0x405486bc, poped=0) at ../compile.c:3473
#17 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf803830,
node=0x40548644, poped=0) at ../compile.c:3473
#18 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf803b50,
node=0x405485a4, poped=0) at ../compile.c:3473
#19 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf803e70,
node=0x4054852c, poped=0) at ../compile.c:3473
#20 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf804190,
node=0x405484a0, poped=0) at ../compile.c:3473
#21 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8044b0,
node=0x40548428, poped=0) at ../compile.c:3473
#22 0x400d07c4 in iseq_compile_each (iseq=0x80c0160, ret=0xbf8047d0,
node=0x40548388, poped=0) at ../compile.c:3473
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) q
The program is running. Exit anyway? (y or n) y
ちなみに[powerpc-darwin8.8.0]でも同様でした。何かの参考になれば幸い
です。
# とかいう上記のような、英語でもどうでもいいようなメールは、-enの方に
# 投げた方がいいでしょうか? 望ましいなら以後、そうします。
--
斎藤ただし
--
ML: yarv-dev quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml
-> 1104 2006-11-09 20:42 [shiba mail2.accsnet.] long method-chain causes segv 1106 2006-11-14 11:26 ┗[ko1 atdot.net ]