summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authorUrabe, Shyouhei <shyouhei@ruby-lang.org>2019-05-23 17:02:07 +0900
committerUrabe, Shyouhei <shyouhei@ruby-lang.org>2019-05-23 17:24:53 +0900
commit763989c6c5a553fa072208e53707813fbde916d0 (patch)
tree73ce864319e09a1d93a136c588964bba10464bf3 /internal.h
parent8fce83339b6a862001c4fbad6bcd72dc3efee136 (diff)
prefix ASAN related inline functions asan_
requested by Ko1.
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/internal.h b/internal.h
index 22b893a24e..a531a12608 100644
--- a/internal.h
+++ b/internal.h
@@ -108,7 +108,6 @@ extern "C" {
# define __asan_poison_memory_region(x, y)
# define __asan_unpoison_memory_region(x, y)
# define __asan_region_is_poisoned(x, y) 0
-# define poisoned_object_p(x) 0
#endif
#ifdef HAVE_SANITIZER_MSAN_INTERFACE_H
@@ -125,30 +124,28 @@ extern "C" {
#endif
static inline void
-poison_memory_region(const volatile void *ptr, size_t size)
+asan_poison_memory_region(const volatile void *ptr, size_t size)
{
__msan_poison(ptr, size);
__asan_poison_memory_region(ptr, size);
}
static inline void
-poison_object(VALUE obj)
+asan_poison_object(VALUE obj)
{
- struct RVALUE *ptr = (void *)obj;
- poison_memory_region(ptr, SIZEOF_VALUE);
+ MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
+ asan_poison_memory_region(ptr, SIZEOF_VALUE);
}
-#if __has_feature(address_sanitizer)
static inline void *
-poisoned_object_p(VALUE obj)
+asan_poisoned_object_p(VALUE obj)
{
- struct RVALUE *ptr = (void *)obj;
+ MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
return __asan_region_is_poisoned(ptr, SIZEOF_VALUE);
}
-#endif
static inline void
-unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p)
+asan_unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p)
{
__asan_unpoison_memory_region(ptr, size);
if (malloc_p) {
@@ -160,10 +157,10 @@ unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p)
}
static inline void
-unpoison_object(VALUE obj, bool newobj_p)
+asan_unpoison_object(VALUE obj, bool newobj_p)
{
- struct RVALUE *ptr = (void *)obj;
- unpoison_memory_region(ptr, SIZEOF_VALUE, newobj_p);
+ MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
+ asan_unpoison_memory_region(ptr, SIZEOF_VALUE, newobj_p);
}
#endif