From d598654c742eddc4284814021a8d4b1d6e48b604 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 28 Sep 2020 09:43:19 -0700 Subject: [PATCH] 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. --- gc.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/gc.c b/gc.c index 075019a315..93652ffd4c 100644 --- a/gc.c +++ b/gc.c @@ -8727,33 +8727,30 @@ gc_ref_update(void *vstart, void *vend, size_t stride, void * data) /* 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 (RVALUE_PAGE_MARKING(page, v)) { + page->flags.has_remembered_objects = TRUE; + } + gc_update_object_references(objspace, v); + } - if (poisoned) { - GC_ASSERT(BUILTIN_TYPE(v) == T_NONE); - asan_poison_object(v); - } + if (poisoned) { + asan_poison_object(v); } }