From 02299d68bcb0e6eabab2b973b28e9dafbafe6149 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 21 Sep 2025 17:30:51 +0200 Subject: [PATCH 1/2] Exclude failing GC finalizer tests with ASAN * See https://bugs.ruby-lang.org/issues/21613 --- test/ruby/test_gc.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 1c4561ed5a45ec..a8a937f078a9da 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -825,6 +825,8 @@ def test_vm_object end def test_exception_in_finalizer_procs + require '-test-/stack' + omit 'failing with ASAN' if Thread.asan? assert_in_out_err(["-W0"], "#{<<~"begin;"}\n#{<<~'end;'}", %w[c1 c2]) c1 = proc do puts "c1" @@ -845,6 +847,8 @@ def test_exception_in_finalizer_procs end def test_exception_in_finalizer_method + require '-test-/stack' + omit 'failing with ASAN' if Thread.asan? assert_in_out_err(["-W0"], "#{<<~"begin;"}\n#{<<~'end;'}", %w[c1 c2]) def self.c1(x) puts "c1" From 4a082b5d347951ad7d2007d6726f3cfe5232a382 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sun, 21 Sep 2025 11:33:23 -0400 Subject: [PATCH 2/2] Fix assertion in rb_gc_impl_mark_weak The FL_WB_PROTECTED flag is no longer used and is not set on objects, so that assertion cannot be true. Instead, we should use RVALUE_WB_UNPROTECTED. --- gc/default/default.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc/default/default.c b/gc/default/default.c index b7d37149734c40..423d27dde11c84 100644 --- a/gc/default/default.c +++ b/gc/default/default.c @@ -4505,7 +4505,7 @@ rb_gc_impl_mark_weak(void *objspace_ptr, VALUE *ptr) { rb_objspace_t *objspace = objspace_ptr; - GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED)); + GC_ASSERT(objspace->rgengc.parent_object == 0 || !RVALUE_WB_UNPROTECTED(objspace, objspace->rgengc.parent_object)); VALUE obj = *ptr;