|
void | __sanitizer_set_report_path (const char *path) |
|
void | __sanitizer_set_report_fd (void *fd) |
|
void | __sanitizer_sandbox_on_notify (__sanitizer_sandbox_arguments *args) |
|
void | __sanitizer_report_error_summary (const char *error_summary) |
|
uint16_t | __sanitizer_unaligned_load16 (const void *p) |
| Loads a 16-bit unaligned value. More...
|
|
uint32_t | __sanitizer_unaligned_load32 (const void *p) |
| Loads a 32-bit unaligned value. More...
|
|
uint64_t | __sanitizer_unaligned_load64 (const void *p) |
| Loads a 64-bit unaligned value. More...
|
|
void | __sanitizer_unaligned_store16 (void *p, uint16_t x) |
| Stores a 16-bit unaligned value. More...
|
|
void | __sanitizer_unaligned_store32 (void *p, uint32_t x) |
| Stores a 32-bit unaligned value. More...
|
|
void | __sanitizer_unaligned_store64 (void *p, uint64_t x) |
| Stores a 64-bit unaligned value. More...
|
|
int | __sanitizer_acquire_crash_state () |
|
void | __sanitizer_annotate_contiguous_container (const void *beg, const void *end, const void *old_mid, const void *new_mid) |
| Annotates the current state of a contiguous container, such as std::vector , std::string , or similar. More...
|
|
int | __sanitizer_verify_contiguous_container (const void *beg, const void *mid, const void *end) |
| Returns true if the contiguous container [beg, end) is properly poisoned. More...
|
|
const void * | __sanitizer_contiguous_container_find_bad_address (const void *beg, const void *mid, const void *end) |
| Similar to __sanitizer_verify_contiguous_container() but also returns the address of the first improperly poisoned byte. More...
|
|
void | __sanitizer_print_stack_trace (void) |
| Prints the stack trace leading to this call (useful for calling from the debugger). More...
|
|
void | __sanitizer_symbolize_pc (void *pc, const char *fmt, char *out_buf, size_t out_buf_size) |
|
void | __sanitizer_symbolize_global (void *data_ptr, const char *fmt, char *out_buf, size_t out_buf_size) |
|
void | __sanitizer_set_death_callback (void(*callback)(void)) |
| Sets the callback to be called immediately before death on error. More...
|
|
void | __sanitizer_weak_hook_memcmp (void *called_pc, const void *s1, const void *s2, size_t n, int result) |
| Interceptor hook for memcmp() . More...
|
|
void | __sanitizer_weak_hook_strncmp (void *called_pc, const char *s1, const char *s2, size_t n, int result) |
| Interceptor hook for strncmp() . More...
|
|
void | __sanitizer_weak_hook_strncasecmp (void *called_pc, const char *s1, const char *s2, size_t n, int result) |
| Interceptor hook for strncasecmp() . More...
|
|
void | __sanitizer_weak_hook_strcmp (void *called_pc, const char *s1, const char *s2, int result) |
| Interceptor hook for strcmp() . More...
|
|
void | __sanitizer_weak_hook_strcasecmp (void *called_pc, const char *s1, const char *s2, int result) |
| Interceptor hook for strcasecmp() . More...
|
|
void | __sanitizer_weak_hook_strstr (void *called_pc, const char *s1, const char *s2, char *result) |
| Interceptor hook for strstr() . More...
|
|
void | __sanitizer_weak_hook_strcasestr (void *called_pc, const char *s1, const char *s2, char *result) |
|
void | __sanitizer_weak_hook_memmem (void *called_pc, const void *s1, size_t len1, const void *s2, size_t len2, void *result) |
|
void | __sanitizer_print_memory_profile (size_t top_percent, size_t max_number_of_contexts) |
|
void | __sanitizer_start_switch_fiber (void **fake_stack_save, const void *bottom, size_t size) |
| Notify ASan that a fiber switch has started (required only if implementing your own fiber library). More...
|
|
void | __sanitizer_finish_switch_fiber (void *fake_stack_save, const void **bottom_old, size_t *size_old) |
| Notify ASan that a fiber switch has completed (required only if implementing your own fiber library). More...
|
|
int | __sanitizer_get_module_and_offset_for_pc (void *pc, char *module_path, size_t module_path_len, void **pc_offset) |
|
void __sanitizer_annotate_contiguous_container |
( |
const void * |
beg, |
|
|
const void * |
end, |
|
|
const void * |
old_mid, |
|
|
const void * |
new_mid |
|
) |
| |
Annotates the current state of a contiguous container, such as std::vector
, std::string
, or similar.
A contiguous container is a container that keeps all of its elements in a contiguous region of memory. The container owns the region of memory [beg, end)
; the memory [beg, mid)
is used to store the current elements, and the memory [mid, end)
is reserved for future elements (beg <= mid <= end
). For example, in std::vector<> v
:
end = beg +
v.capacity() *
sizeof(
v[0]);
mid = beg +
v.size() *
sizeof(
v[0]);
This annotation tells the Sanitizer tool about the current state of the container so that the tool can report errors when memory from [mid, end)
is accessed. Insert this annotation into methods like push_back()
or pop_back()
. Supply the old and new values of mid
(old_mid
and new_mid
). In the initial state mid == end
, so that should be the final state when the container is destroyed or when the container reallocates the storage.
For ASan, beg
should be 8-aligned and end
should be either 8-aligned or it should point to the end of a separate heap-, stack-, or global-allocated buffer. So the following example will not work:
char *beg = (
char *)&
x[0];
char *end = beg + 12;
The following, however, will work:
char *beg = (
char*)&
x[0];
char *end = beg + 12;
static __inline__ int32_t
- Note
- Use this function with caution and do not use for anything other than vector-like classes.
- Parameters
-
beg | Beginning of memory region. |
end | End of memory region. |
old_mid | Old middle of memory region. |
new_mid | New middle of memory region. |
void __sanitizer_start_switch_fiber |
( |
void ** |
fake_stack_save, |
|
|
const void * |
bottom, |
|
|
size_t |
size |
|
) |
| |
Notify ASan that a fiber switch has started (required only if implementing your own fiber library).
Before switching to a different stack, you must call __sanitizer_start_switch_fiber()
with a pointer to the bottom of the destination stack and with its size. When code starts running on the new stack, it must call __sanitizer_finish_switch_fiber()
to finalize the switch. The __sanitizer_start_switch_fiber()
function takes a void**
pointer argument to store the current fake stack if there is one (it is necessary when the runtime option detect_stack_use_after_return
is enabled).
When restoring a stack, this void**
pointer must be given to the __sanitizer_finish_switch_fiber()
function. In most cases, this pointer can be stored on the stack immediately before switching. When leaving a fiber definitely, NULL must be passed as the first argument to the __sanitizer_start_switch_fiber()
function so that the fake stack is destroyed. If your program does not need stack use-after-return detection, you can always pass NULL to these two functions.
- Note
- The fake stack mechanism is disabled during fiber switch, so if a signal callback runs during the switch, it will not benefit from stack use-after-return detection.
- Parameters
-
fake_stack_save | [out] Fake stack save location. |
bottom | Bottom address of stack. |
size | Size of stack in bytes. |
int __sanitizer_verify_contiguous_container |
( |
const void * |
beg, |
|
|
const void * |
mid, |
|
|
const void * |
end |
|
) |
| |
Returns true if the contiguous container [beg, end)
is properly poisoned.
Proper poisoning could occur, for example, with __sanitizer_annotate_contiguous_container
), that is, if [beg, mid)
is addressable and [mid, end)
is unaddressable. Full verification requires O (end - beg
) time; this function tries to avoid such complexity by touching only parts of the container around beg
, mid
, and end
.
- Parameters
-
beg | Beginning of memory region. |
mid | Middle of memory region. |
end | Old end of memory region. |
- Returns
- True if the contiguous container
[beg, end)
is properly poisoned.