Fix ASAN errors when updating call cache
Invalidating call cache walks the heap, so we need to take care to un-poison objects when examining them
This commit is contained in:
parent
0767d387ec
commit
664eeda66e
8
gc.c
8
gc.c
@ -2544,6 +2544,8 @@ vm_ccs_free(struct rb_class_cc_entries *ccs, int alive, rb_objspace_t *objspace,
|
|||||||
for (int i=0; i<ccs->len; i++) {
|
for (int i=0; i<ccs->len; i++) {
|
||||||
const struct rb_callcache *cc = ccs->entries[i].cc;
|
const struct rb_callcache *cc = ccs->entries[i].cc;
|
||||||
if (!alive) {
|
if (!alive) {
|
||||||
|
void *ptr = asan_poisoned_object_p((VALUE)cc);
|
||||||
|
asan_unpoison_object((VALUE)cc, false);
|
||||||
// ccs can be free'ed.
|
// ccs can be free'ed.
|
||||||
if (is_pointer_to_heap(objspace, (void *)cc) &&
|
if (is_pointer_to_heap(objspace, (void *)cc) &&
|
||||||
IMEMO_TYPE_P(cc, imemo_callcache) &&
|
IMEMO_TYPE_P(cc, imemo_callcache) &&
|
||||||
@ -2551,8 +2553,14 @@ vm_ccs_free(struct rb_class_cc_entries *ccs, int alive, rb_objspace_t *objspace,
|
|||||||
// OK. maybe target cc.
|
// OK. maybe target cc.
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (ptr) {
|
||||||
|
asan_poison_object((VALUE)cc);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ptr) {
|
||||||
|
asan_poison_object((VALUE)cc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vm_cc_invalidate(cc);
|
vm_cc_invalidate(cc);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user