summaryrefslogtreecommitdiff
path: root/ext/objspace/objspace_dump.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-09-25 14:50:54 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2020-09-28 08:20:23 -0700
commit18b3f0f54c66632b1039a27634a8a449a7812e34 (patch)
tree3e5cb32306bb810c0e89221c2ff4f1fe62826b18 /ext/objspace/objspace_dump.c
parentac414139ec0fc5626902231c4d45fffeb347263e (diff)
downloadruby-18b3f0f54c66632b1039a27634a8a449a7812e34.tar.gz
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
Diffstat (limited to 'ext/objspace/objspace_dump.c')
-rw-r--r--ext/objspace/objspace_dump.c8
1 files changed, 8 insertions, 0 deletions
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;
}