Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
asan_annotations.hpp File Reference

Go to the source code of this file.

Detailed Description

Provides a stable interface to asan's public API.

Macro Definition Documentation

◆ ARENE_ASAN_POISON_MEMORY_REGION

#define ARENE_ASAN_POISON_MEMORY_REGION ( addr,
size )
Value:
ARENE_ASAN_POISON_MEMORY_REGION_IMPL((addr), (size))

Marks a memory region as unaddressable from ASAN's perspective.

Parameters
addrThe starting address of the region.
sizeThe size, in bytes, of the memory region to poison.
Postcondition
If the binary has been compiled under address sanitizer, any attempt to read from the memory location without first marking it as addressable will trigger an ASAN violation. Otherwise it is a noop.
Note
This is a simple wrapper around ASAN's public interface. If the platform does not provides <sanitizer/asan_interface.h> , this is a noop
Warning
Due to asan alignment restrictions, this function may only poison a subregion of the input region. In addition, this method is not thread-safe WRT other invocations of ASAN annotations that interact with the same memory region.

◆ ARENE_ASAN_POISON_MEMORY_SPAN

#define ARENE_ASAN_POISON_MEMORY_SPAN ( span_of_t)
Value:
ARENE_ASAN_POISON_MEMORY_SPAN_IMPL(span_of_t)

Marks a memory region as unaddressable from ASAN's perspective.

Parameters
span_of_tAn arene::base::span<T> defining the range of memory to poison. If T is not arene::base::byte, then the size of the region to mark will be determined by first converting the span to bytes via arene::base::span::as_bytes , and then using the size of that resulting span.
Postcondition
If the binary has been compiled under address sanitizer, any attempt to read from the memory location without first marking it as addressable will trigger an ASAN violation. Otherwise it is a noop.
Note
This is a simple wrapper around ASAN's public interface. If the platform does not provides <sanitizer/asan_interface.h> , this is a nop
Warning
Due to asan alignment restrictions, this function may only poison a subregion of the input region. In addition, this method is not thread-safe WRT other invocations of ASAN annotations that interact with the same memory region.

◆ ARENE_ASAN_UNPOISON_MEMORY_REGION

#define ARENE_ASAN_UNPOISON_MEMORY_REGION ( addr,
size )
Value:
ARENE_ASAN_UNPOISON_MEMORY_REGION_IMPL((addr), (size))

Marks a memory region as addressable from ASAN's perspective.

Parameters
addrThe starting address of the region.
sizeThe size, in bytes, of the memory region.
Postcondition
If the binary has been compiled under address sanitizer, the memory region will have no special considerations from ASAN's perspective. Otherwise it is a noop.
Note
This is a simple wrapper around ASAN's public interface. If the platform does not provides <sanitizer/asan_interface.h> , this is a noop
Warning
Due to asan alignment restrictions, this function may only unpoison a subregion of the input region. In addition, this method is not thread-safe WRT other invocations of ASAN annotations that interact with the same memory region.

◆ ARENE_ASAN_UNPOISON_MEMORY_SPAN

#define ARENE_ASAN_UNPOISON_MEMORY_SPAN ( span_of_t)
Value:
ARENE_ASAN_UNPOISON_MEMORY_SPAN_IMPL(span_of_t)

Marks a memory region as addressable from ASAN's perspective.

Parameters
span_of_tA span defining the range of memory to unpoison. If T is not arene::base::byte, then the size of the region to mark will be determined by first converting the span to bytes via arene::base::span::as_bytes , and then using the size of that resulting span.
Postcondition
If the binary has been compiled under address sanitizer, the memory region will have no special considerations from ASAN's perspective. Otherwise it is a noop.
Note
This is a simple wrapper around ASAN's public interface. If the platform does not provides <sanitizer/asan_interface.h> , this is a nop
Warning
Due to asan alignment restrictions, this function may only unpoison a subregion of the input region. In addition, this method is not thread-safe WRT other invocations of ASAN annotations that interact with the same memory region.