From cbb6a3a6aa40481c976afc4e26f90d1c0b0e2a05 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 6 Nov 2018 05:06:20 +0000 Subject: annotate functions to blacklist MSAN In these functions we are intentionally reading memory address not owned by us. These reads should not be diagnosed. See also [Bug #8680] See also https://travis-ci.org/ruby/ruby/jobs/451202718 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 4 ++-- internal.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gc.c b/gc.c index e02935d66f..bf193d49f9 100644 --- a/gc.c +++ b/gc.c @@ -864,7 +864,7 @@ static void gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap); static inline void gc_mark(rb_objspace_t *objspace, VALUE ptr); static void gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr); -static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr); +NO_SANITIZE("memory", static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr)); static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr); static int gc_mark_stacked_objects_incremental(rb_objspace_t *, size_t count); @@ -872,7 +872,7 @@ static int gc_mark_stacked_objects_all(rb_objspace_t *); static void gc_grey(rb_objspace_t *objspace, VALUE ptr); static inline int gc_mark_set(rb_objspace_t *objspace, VALUE obj); -static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr); +NO_SANITIZE("memory", static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)); static void push_mark_stack(mark_stack_t *, VALUE); static int pop_mark_stack(mark_stack_t *, VALUE *); diff --git a/internal.h b/internal.h index 4dc37f3aea..0de37005ae 100644 --- a/internal.h +++ b/internal.h @@ -68,6 +68,10 @@ extern "C" { # define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) x #endif +#ifndef NO_SANITIZE +#define NO_SANITIZE(x, y) +#endif + #ifdef HAVE_VALGRIND_MEMCHECK_H # include # ifndef VALGRIND_MAKE_MEM_DEFINED -- cgit v1.2.3