mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix ASAN errors
This commit is contained in:
parent
70cd351c7c
commit
589a8026f0
Notes:
git
2021-01-14 07:54:13 +09:00
1 changed files with 17 additions and 4 deletions
21
gc.c
21
gc.c
|
@ -2217,7 +2217,9 @@ ractor_cache_slots(rb_objspace_t *objspace, rb_ractor_t *cr)
|
||||||
page->free_slots = 0;
|
page->free_slots = 0;
|
||||||
page->freelist = NULL;
|
page->freelist = NULL;
|
||||||
|
|
||||||
|
asan_unpoison_object((VALUE)cr->newobj_cache.freelist, false);
|
||||||
GC_ASSERT(RB_TYPE_P((VALUE)cr->newobj_cache.freelist, T_NONE));
|
GC_ASSERT(RB_TYPE_P((VALUE)cr->newobj_cache.freelist, T_NONE));
|
||||||
|
asan_poison_object((VALUE)cr->newobj_cache.freelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE(static VALUE newobj_slowpath(VALUE klass, VALUE flags, rb_objspace_t *objspace, rb_ractor_t *cr, int wb_protected));
|
ALWAYS_INLINE(static VALUE newobj_slowpath(VALUE klass, VALUE flags, rb_objspace_t *objspace, rb_ractor_t *cr, int wb_protected));
|
||||||
|
@ -5079,11 +5081,22 @@ gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||||
RUBY_DEBUG_LOG("ractor using_page:%p freelist:%p", page, freelist);
|
RUBY_DEBUG_LOG("ractor using_page:%p freelist:%p", page, freelist);
|
||||||
|
|
||||||
if (page && freelist) {
|
if (page && freelist) {
|
||||||
RVALUE **p = &page->freelist;
|
asan_unpoison_memory_region(&page->freelist, sizeof(RVALUE*), false);
|
||||||
while (*p) {
|
if (page->freelist) {
|
||||||
p = &(*p)->as.free.next;
|
RVALUE *p = page->freelist;
|
||||||
|
asan_unpoison_object((VALUE)p, false);
|
||||||
|
while (p->as.free.next) {
|
||||||
|
RVALUE *prev = p;
|
||||||
|
p = p->as.free.next;
|
||||||
|
asan_poison_object((VALUE)prev);
|
||||||
|
asan_unpoison_object((VALUE)p, false);
|
||||||
}
|
}
|
||||||
*p = freelist;
|
p->as.free.next = freelist;
|
||||||
|
asan_poison_object((VALUE)p);
|
||||||
|
} else {
|
||||||
|
page->freelist = freelist;
|
||||||
|
}
|
||||||
|
asan_poison_memory_region(&page->freelist, sizeof(RVALUE*));
|
||||||
}
|
}
|
||||||
|
|
||||||
r->newobj_cache.using_page = NULL;
|
r->newobj_cache.using_page = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue