From ff07e5c264c82f73b0368dd0bc2ae39f78678519 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 9 Aug 2022 02:15:10 +0900 Subject: [PATCH] Skip poisoned regions Poisoned regions cannot be accessed without unpoisoning outside gc.c. Specifically, debug.gem is terminated by AddressSanitizer. ``` SUMMARY: AddressSanitizer: use-after-poison iseq_collector.c:39 in iseq_i ``` --- gc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index df4c99b15b..ecb4aa7e20 100644 --- a/gc.c +++ b/gc.c @@ -3904,7 +3904,8 @@ objspace_each_objects_try(VALUE arg) uintptr_t pstart = (uintptr_t)page->start; uintptr_t pend = pstart + (page->total_slots * size_pool->slot_size); - if ((*data->callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) { + if (!__asan_region_is_poisoned((void *)pstart, pend - pstart) && + (*data->callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) { break; }