ruby-changes:64262
From: Koichi <ko1@a...>
Date: Fri, 18 Dec 2020 14:16:21 +0900 (JST)
Subject: [ruby-changes:64262] cfa124ef05 (master): acquire VM lock on gc_verify_internal_consistency()
https://git.ruby-lang.org/ruby.git/commit/?id=cfa124ef05 From cfa124ef05e1b899c1953888c0fb3076388a0d8e Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 18 Dec 2020 14:14:40 +0900 Subject: acquire VM lock on gc_verify_internal_consistency() There is a case to call this function without VM lock acquiring. diff --git a/gc.c b/gc.c index f59ac6a..d066ed9 100644 --- a/gc.c +++ b/gc.c @@ -7142,15 +7142,18 @@ gc_verify_internal_consistency_(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L7142 static void gc_verify_internal_consistency(rb_objspace_t *objspace) { - ASSERT_vm_locking(); - rb_vm_barrier(); // stop other ractors - - unsigned int prev_during_gc = during_gc; - during_gc = FALSE; // stop gc here + RB_VM_LOCK_ENTER(); { - gc_verify_internal_consistency_(objspace); + rb_vm_barrier(); // stop other ractors + + unsigned int prev_during_gc = during_gc; + during_gc = FALSE; // stop gc here + { + gc_verify_internal_consistency_(objspace); + } + during_gc = prev_during_gc; } - during_gc = prev_during_gc; + RB_VM_LOCK_LEAVE(); } void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/