Project

General

Profile

Bug #11750

SEGV with Enumerator, yield and proc.

Added by akr (Akira Tanaka) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-11-29 trunk 52789) [x86_64-linux]
[ruby-core:71737]

Description

I found SEGV as follows.

% cat z.rb 
def f
  Enumerator.new {|y|
    1000000.times {
      yield
      y.yield
    }
  }
end

def g
  x = proc {}
  f(&x)
end

e = g
e.each {}

% ./miniruby z.rb
(snip)

Files

bug-11750.log (11.2 KB) bug-11750.log nobu (Nobuyoshi Nakada), 11/30/2015 05:35 AM

Associated revisions

Revision 5dc676a5
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 53144
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

Revision 53144
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

Revision 53144
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

Revision 53144
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

Revision 53144
Added by ko1 (Koichi Sasada) over 3 years ago

  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

History

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

By bisecting, it raises SytemStackError or segfaults since r51243.

* vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t.
  Instead of this field, mark given block in Proc at rb_env_t::env.

Enumerator, Generator, or Yielder may need more marking or write-barrier.

Updated by ko1 (Koichi Sasada) over 3 years ago

  • Assignee set to ko1 (Koichi Sasada)
#3

Updated by ko1 (Koichi Sasada) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r53144.


  • vm.c: fix mark miss for proc given as passed block.
    [Bug #11750]

  • vm.c (vm_make_proc_from_block): should return a Proc object
    if block is given. Previous implementation returns
    a Proc object only when corresponding Proc object is not
    available.

  • vm.c (vm_make_env_each): ditto.

  • test/ruby/test_proc.rb: add a test for this bug.

Also available in: Atom PDF