ruby-changes:63188
From: Aaron <ko1@a...>
Date: Tue, 29 Sep 2020 01:45:45 +0900 (JST)
Subject: [ruby-changes:63188] d598654c74 (master): Fix ASAN and don't check SPECIAL_CONST_P
https://git.ruby-lang.org/ruby.git/commit/?id=d598654c74 From d598654c742eddc4284814021a8d4b1d6e48b604 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Mon, 28 Sep 2020 09:43:19 -0700 Subject: Fix ASAN and don't check SPECIAL_CONST_P Heap allocated objects are never special constants. Since we're walking the heap, we know none of these objects can be special. Also, adding the object to the freelist will poison the object, so we can't check that the type is T_NONE after poison. diff --git a/gc.c b/gc.c index 075019a..93652ff 100644 --- a/gc.c +++ b/gc.c @@ -8727,33 +8727,30 @@ gc_ref_update(void *vstart, void *vend, size_t stride, void * data) https://github.com/ruby/ruby/blob/trunk/gc.c#L8727 /* For each object on the page */ for (; v != (VALUE)vend; v += stride) { - if (!SPECIAL_CONST_P(v)) { - void *poisoned = asan_poisoned_object_p(v); - asan_unpoison_object(v, false); + void *poisoned = asan_poisoned_object_p(v); + asan_unpoison_object(v, false); - switch (BUILTIN_TYPE(v)) { - case T_NONE: - heap_page_add_freeobj(objspace, page, v); - free_slots++; - break; - case T_MOVED: - break; - case T_ZOMBIE: - break; - default: - if (RVALUE_WB_UNPROTECTED(v)) { - page->flags.has_uncollectible_shady_objects = TRUE; - } - if (RVALUE_PAGE_MARKING(page, v)) { - page->flags.has_remembered_objects = TRUE; - } - gc_update_object_references(objspace, v); + switch (BUILTIN_TYPE(v)) { + case T_NONE: + heap_page_add_freeobj(objspace, page, v); + free_slots++; + break; + case T_MOVED: + break; + case T_ZOMBIE: + break; + default: + if (RVALUE_WB_UNPROTECTED(v)) { + page->flags.has_uncollectible_shady_objects = TRUE; } - - if (poisoned) { - GC_ASSERT(BUILTIN_TYPE(v) == T_NONE); - asan_poison_object(v); + if (RVALUE_PAGE_MARKING(page, v)) { + page->flags.has_remembered_objects = TRUE; } + gc_update_object_references(objspace, v); + } + + if (poisoned) { + asan_poison_object(v); } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/