1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Unpoison freelist when iterating over it in gc_sweep_page

This commit is contained in:
Jemma Issroff 2022-05-04 14:33:05 -04:00 committed by Aaron Patterson
parent 3a31b80bea
commit d7df8c6964
Notes: git 2022-05-05 04:49:46 +09:00

2
gc.c
View file

@ -5473,11 +5473,13 @@ gc_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct gc_sweep_context
#if RGENGC_CHECK_MODE
short freelist_len = 0;
asan_unpoison_memory_region(&sweep_page->freelist, sizeof(RVALUE*), false);
RVALUE *ptr = sweep_page->freelist;
while (ptr) {
freelist_len++;
ptr = ptr->as.free.next;
}
asan_poison_memory_region(&sweep_page->freelist, sizeof(RVALUE*));
if (freelist_len != sweep_page->free_slots) {
rb_bug("inconsistent freelist length: expected %d but was %d", sweep_page->free_slots, freelist_len);
}