From 18b3f0f54c66632b1039a27634a8a449a7812e34 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 25 Sep 2020 14:50:54 -0700 Subject: Make ext/objspace ASAN friendly ext/objspace iterates over the heap, but some slots in the heap are poisoned, so we need to take care of that when running with ASAN --- ext/objspace/objspace_dump.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext/objspace/objspace_dump.c') diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index e12b553794..7a5f44aaad 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -16,6 +16,7 @@ #include "internal.h" #include "internal/hash.h" #include "internal/string.h" +#include "internal/sanitizers.h" #include "node.h" #include "objspace.h" #include "ruby/debug.h" @@ -508,8 +509,15 @@ heap_i(void *vstart, void *vend, size_t stride, void *data) struct dump_config *dc = (struct dump_config *)data; VALUE v = (VALUE)vstart; for (; v != (VALUE)vend; v += stride) { + void *ptr = asan_poisoned_object_p(v); + asan_unpoison_object(v, false); + if (dc->full_heap || RBASIC(v)->flags) dump_object(v, dc); + + if (ptr) { + asan_poison_object(v); + } } return 0; } -- cgit v1.2.1