Skip to content

Commit

Permalink
Export asan_poison_object
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Dec 16, 2024
1 parent 214ee7e commit ac979ac
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions internal/sanitizers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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.
*
Expand All @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit ac979ac

Please sign in to comment.