From ac979ac62318b55601f7ff95adffea54043b2f9e Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 13 Dec 2024 13:46:29 -0500 Subject: [PATCH] Export asan_poison_object --- internal/sanitizers.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/internal/sanitizers.h b/internal/sanitizers.h index aac508874bbfe0..ed5bf789ad460b 100644 --- a/internal/sanitizers.h +++ b/internal/sanitizers.h @@ -119,13 +119,6 @@ asan_poison_memory_region(const volatile void *ptr, size_t size) __asan_poison_memory_region(ptr, size); } -/** - * This is a variant of asan_poison_memory_region that takes a VALUE. - * - * @param[in] obj target object. - */ -void asan_poison_object(VALUE obj); - #ifdef RUBY_ASAN_ENABLED #define asan_poison_object_if(ptr, obj) do { \ if (ptr) asan_poison_object(obj); \ @@ -134,6 +127,14 @@ void asan_poison_object(VALUE obj); #define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj)) #endif +RUBY_SYMBOL_EXPORT_BEGIN +/** + * This is a variant of asan_poison_memory_region that takes a VALUE. + * + * @param[in] obj target object. + */ +void asan_poison_object(VALUE obj); + /** * This function predicates if the given object is fully addressable or not. * @@ -143,6 +144,16 @@ void asan_poison_object(VALUE obj); */ void *asan_poisoned_object_p(VALUE obj); +/** + * This is a variant of asan_unpoison_memory_region that takes a VALUE. + * + * @param[in] obj target object. + * @param[in] malloc_p if the memory region is like a malloc's return value or not. + */ +void asan_unpoison_object(VALUE obj, bool newobj_p); + +RUBY_SYMBOL_EXPORT_END + /** * This function asserts that a (formally poisoned) memory region from ptr to * size is now addressable. Write access to such memory region gets allowed. @@ -170,14 +181,6 @@ asan_unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p } } -/** - * This is a variant of asan_unpoison_memory_region that takes a VALUE. - * - * @param[in] obj target object. - * @param[in] malloc_p if the memory region is like a malloc's return value or not. - */ -void asan_unpoison_object(VALUE obj, bool newobj_p); - static inline void * asan_unpoison_object_temporary(VALUE obj) {