From: s.wanabe@... Date: 2017-09-05T10:46:45+00:00 Subject: [ruby-core:82651] [Ruby trunk Bug#13412] Infinite recursion with define_method may cause silent SEGV or cfp consistency error Issue #13412 has been updated by wanabe (_ wanabe). File 13412.patch added Hmm... r59630 seems to be too hard to backport. I had to cherry-pick r58328, r58353, r58354, r58374, r58377 and r58379 before cherry-picking r59630. They are too many. ``` $ git checkout origin/ruby_2_4 && git checkout -B work && for r in 58328 58353 58354 58374 58377 58379 59630 59676; do git cherry-pick $(git log --grep "trunk@$r" origin/trunk --format="%h") done && make miniruby -j4 && for i in `seq 1 1 10`; do ./miniruby -ve 'define_method(:foo) { foo }; 1.times { 1.times { 1.times { begin; foo; rescue Exception; nil; end } } } ' || break done Note: checking out 'origin/ruby_2_4'. (snip) linking miniruby ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ``` Trimmed patch is here, but I really cannot say this is backport. (which commits correspond with the patch?) ``` $ git checkout origin/ruby_2_4 && git checkout -B work && patch -d $(git rev-parse --show-toplevel) -p1 < 13412.patch && make miniruby -j4 && for i in `seq 1 1 10`; do ./miniruby -ve 'define_method(:foo) { foo }; 1.times { 1.times { 1.times { begin; foo; rescue Exception; nil; end } } } ' || break done Note: checking out 'origin/ruby_2_4'. (snip) linking miniruby ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ruby 2.4.2p181 (2017-08-05 revision 59606) [x86_64-linux] ``` ---------------------------------------- Bug #13412: Infinite recursion with define_method may cause silent SEGV or cfp consistency error https://bugs.ruby-lang.org/issues/13412#change-66484 * Author: wanabe (_ wanabe) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0dev (2017-04-09 trunk 58286) [x86_64-linux] * Backport: 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED ---------------------------------------- The script causes silent (no output [BUG]) SEGV or "cfp consistency error" on my environment. ```ruby define_method(:foo) { foo } loop do 1.times do 1.times do begin foo rescue Exception nil end end end end ``` I think this is related to #11430 (maybe same). ---Files-------------------------------- stderr.log (6.96 KB) bug.rb (123 Bytes) bug.sh (775 Bytes) bug13412.r58331.patch (689 Bytes) bug13412.r58367.patch (711 Bytes) bug_stat.sh (296 Bytes) bug.sh (786 Bytes) bug_stat.sh (468 Bytes) bug13412.r58367.patch (1 KB) cfp_before_setjmp.patch (2.09 KB) ensure_stack.patch (850 Bytes) get_tagged_next_cfp.patch (3.33 KB) 13412.patch (1.06 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: