Skip to content
  • nagachika's avatar
    2dd18df4
    merge revision(s)... · 2dd18df4
    nagachika authored
    merge revision(s) 86c26254,7e147621: [Backport #17935]
    
    	Fix a race condition around mjit_recompile
    
    	This fixes SEGVs like https://github.com/ruby/ruby/runs/2715166621?check_suite_focus=true.
    
    	When mjit_recompile is called when mjit_compile is compiling the exact
    	same iseq (and after it called mjit_capture_cc_entries), iseq->body->jit_unit
    	is re-created and its cc_entries becomes NULL. Then, when it tries to
    	lookup cc_entries through iseq->body->jit_unit, it fails.
    	---
    	 mjit.c        | 21 +++++++++++++--------
    	 mjit_worker.c |  4 ++++
    	 2 files changed, 17 insertions(+), 8 deletions(-)
    
    	Do not doubly hold an MJIT lock
    
    	This is a follow-up of 86c26254.
    	CRITICAL_SECTION_START/FINISH are not needed when it's called from an
    	MJIT worker.
    
    	Also, ZALLOC needs to be calloc because ZALLOC may trigger GC, which an
    	MJIT worker must not do.
    	---
    	 mjit.c        | 23 ++++++++++++++---------
    	 mjit_worker.c |  4 ++--
    	 2 files changed, 16 insertions(+), 11 deletions(-)
    2dd18df4
    merge revision(s)...
    nagachika authored
    merge revision(s) 86c26254,7e147621: [Backport #17935]
    
    	Fix a race condition around mjit_recompile
    
    	This fixes SEGVs like https://github.com/ruby/ruby/runs/2715166621?check_suite_focus=true.
    
    	When mjit_recompile is called when mjit_compile is compiling the exact
    	same iseq (and after it called mjit_capture_cc_entries), iseq->body->jit_unit
    	is re-created and its cc_entries becomes NULL. Then, when it tries to
    	lookup cc_entries through iseq->body->jit_unit, it fails.
    	---
    	 mjit.c        | 21 +++++++++++++--------
    	 mjit_worker.c |  4 ++++
    	 2 files changed, 17 insertions(+), 8 deletions(-)
    
    	Do not doubly hold an MJIT lock
    
    	This is a follow-up of 86c26254.
    	CRITICAL_SECTION_START/FINISH are not needed when it's called from an
    	MJIT worker.
    
    	Also, ZALLOC needs to be calloc because ZALLOC may trigger GC, which an
    	MJIT worker must not do.
    	---
    	 mjit.c        | 23 ++++++++++++++---------
    	 mjit_worker.c |  4 ++--
    	 2 files changed, 16 insertions(+), 11 deletions(-)
Loading