Skip to content

Commit

Permalink
Don't check __asan_region_is_poisoned in objspace_each_objects
Browse files Browse the repository at this point in the history
This returns whether or not _any_ piece of memory in the range is
poisoned, not if _all_ of it is. That means that currently, with ASAN
enabled, pages which contain a single poisoned object are skipped
entirely from being iterated with objspace_each* family of functions.

[Bug #20220]
  • Loading branch information
KJTsanaktsidis committed Feb 6, 2024
1 parent 719db18 commit 4f4f3a6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3984,15 +3984,13 @@ 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 (!__asan_region_is_poisoned((void *)pstart, pend - pstart)) {
if (data->each_obj_callback &&
(*data->each_obj_callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) {
break;
}
if (data->each_page_callback &&
(*data->each_page_callback)(page, data->data)) {
break;
}
if (data->each_obj_callback &&
(*data->each_obj_callback)((void *)pstart, (void *)pend, size_pool->slot_size, data->data)) {
break;
}
if (data->each_page_callback &&
(*data->each_page_callback)(page, data->data)) {
break;
}

page = ccan_list_next(&SIZE_POOL_EDEN_HEAP(size_pool)->pages, page, page_node);
Expand Down

0 comments on commit 4f4f3a6

Please sign in to comment.