Skip to content
  • nagachika's avatar
    b422c352
    merge revision(s) 7bd7aee0: [Backport #18464] · b422c352
    nagachika authored
    	Fix interpreter crash caused by RUBY_INTERNAL_EVENT_NEWOBJ + Ractors
    
    	When a Ractor is created whilst a tracepoint for
    	RUBY_INTERNAL_EVENT_NEWOBJ is active, the interpreter crashes. This is
    	because during the early setup of the Ractor, the stdio objects are
    	created, which allocates Ruby objects, which fires the tracepoint.
    	However, the tracepoint machinery tries to dereference the control frame
    	(ec->cfp->pc), which isn't set up yet and so crashes with a null pointer
    	dereference.
    
    	Fix this by not firing GC tracepoints if cfp isn't yet set up.
    	---
    	 gc.c                         |  1 +
    	 test/objspace/test_ractor.rb | 17 +++++++++++++++++
    	 2 files changed, 18 insertions(+)
    	 create mode 100644 test/objspace/test_ractor.rb
    b422c352
    merge revision(s) 7bd7aee0: [Backport #18464]
    nagachika authored
    	Fix interpreter crash caused by RUBY_INTERNAL_EVENT_NEWOBJ + Ractors
    
    	When a Ractor is created whilst a tracepoint for
    	RUBY_INTERNAL_EVENT_NEWOBJ is active, the interpreter crashes. This is
    	because during the early setup of the Ractor, the stdio objects are
    	created, which allocates Ruby objects, which fires the tracepoint.
    	However, the tracepoint machinery tries to dereference the control frame
    	(ec->cfp->pc), which isn't set up yet and so crashes with a null pointer
    	dereference.
    
    	Fix this by not firing GC tracepoints if cfp isn't yet set up.
    	---
    	 gc.c                         |  1 +
    	 test/objspace/test_ractor.rb | 17 +++++++++++++++++
    	 2 files changed, 18 insertions(+)
    	 create mode 100644 test/objspace/test_ractor.rb
Loading