diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-09-25 15:01:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-09-28 08:20:23 -0700 |
commit | b9488accf9e2cbf5f7c47b42b3eb23469f0aa58d (patch) | |
tree | d7c1cf60907100f903c06ff12e2918b77b9961db /vm_method.c | |
parent | b328b830264408b467a5c904a474e7112c5d678c (diff) | |
download | ruby-b9488accf9e2cbf5f7c47b42b3eb23469f0aa58d.tar.gz |
Fix ASAN support when invalidating CCs
Again, this code is walking the heap. Empty slots can be poisoned, so
we need to unpoison before checking the type
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index de48dc65a2..47ad040914 100644 --- a/vm_method.c +++ b/vm_method.c @@ -240,6 +240,8 @@ invalidate_all_cc(void *vstart, void *vend, size_t stride, void *data) { VALUE v = (VALUE)vstart; for (; v != (VALUE)vend; v += stride) { + void *ptr = asan_poisoned_object_p(v); + asan_unpoison_object(v, false); if (RBASIC(v)->flags) { // liveness check if (RB_TYPE_P(v, T_CLASS) || RB_TYPE_P(v, T_ICLASS)) { @@ -249,6 +251,9 @@ invalidate_all_cc(void *vstart, void *vend, size_t stride, void *data) RCLASS_CC_TBL(v) = NULL; } } + if (ptr) { + asan_poison_object(v); + } } return 0; // continue to iteration } |