Skip to content

Commit c480dec

Browse files
committed
Fix RUBY_FREE_AT_EXIT with ASAN
When Ruby is built with ASAN and RUBY_FREE_AT_EXIT is enabled, the following error occurs: READ of size 8 at 0x74c666610020 thread T0 #0 0x593b6712ecc6 in RB_BUILTIN_TYPE include/ruby/internal/value_type.h:191:30 #1 0x593b6712ecc6 in rb_gc_impl_shutdown_free_objects gc_impl.c:3208:17 #2 0x593b6749a62e in ruby_vm_destruct vm.c:3133:17
1 parent 478ada0 commit c480dec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gc_impl.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -3205,8 +3205,10 @@ rb_gc_impl_shutdown_free_objects(void *objspace_ptr)
32053205
uintptr_t pend = p + page->total_slots * stride;
32063206
for (; p < pend; p += stride) {
32073207
VALUE vp = (VALUE)p;
3208-
if (RB_BUILTIN_TYPE(vp) != T_NONE) {
3209-
rb_gc_obj_free(objspace, vp);
3208+
asan_unpoisoning_object(vp) {
3209+
if (RB_BUILTIN_TYPE(vp) != T_NONE) {
3210+
rb_gc_obj_free(objspace, vp);
3211+
}
32103212
}
32113213
}
32123214
}

0 commit comments

Comments
 (0)