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

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
```
This commit is contained in:
Nobuyoshi Nakada 2022-08-09 02:15:10 +09:00
parent 44264b4fee
commit ff07e5c264
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

3
gc.c
View file

@ -3904,7 +3904,8 @@ objspace_each_objects_try(VALUE arg)
uintptr_t pstart = (uintptr_t)page->start; uintptr_t pstart = (uintptr_t)page->start;
uintptr_t pend = pstart + (page->total_slots * size_pool->slot_size); 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; break;
} }