ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Classes | Macros | Functions
common_interface_defs.h File Reference
#include <stddef.h>
#include <stdint.h>
Include dependency graph for common_interface_defs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __sanitizer_sandbox_arguments
 

Macros

#define __has_feature(x)   0
 

Functions

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)
 

Macro Definition Documentation

◆ __has_feature

#define __has_feature (   x)    0

Definition at line 20 of file common_interface_defs.h.

Function Documentation

◆ __sanitizer_acquire_crash_state()

int __sanitizer_acquire_crash_state ( )

◆ __sanitizer_annotate_contiguous_container()

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:

beg = &v[0];
end = beg + v.capacity() * sizeof(v[0]);
mid = beg + v.size() * sizeof(v[0]);
do v
Definition: arm_acle.h:76

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:

int64_t x[2]; // 16 bytes, 8-aligned
char *beg = (char *)&x[0];
char *end = beg + 12; // Not 8-aligned, not the end of the buffer

The following, however, will work:

int32_t x[3]; // 12 bytes, but 8-aligned under ASan.
char *beg = (char*)&x[0];
char *end = beg + 12; // Not 8-aligned, but is the end of the buffer
static __inline__ int32_t
Definition: arm_mve.h:51
Note
Use this function with caution and do not use for anything other than vector-like classes.
Parameters
begBeginning of memory region.
endEnd of memory region.
old_midOld middle of memory region.
new_midNew middle of memory region.

◆ __sanitizer_contiguous_container_find_bad_address()

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.

Returns NULL if the area is poisoned properly.

Parameters
begBeginning of memory region.
midMiddle of memory region.
endOld end of memory region.
Returns
The bad address or NULL.

◆ __sanitizer_finish_switch_fiber()

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).

When code starts running on the new stack, it must call __sanitizer_finish_switch_fiber() to finalize the switch. For usage details, see the description of __sanitizer_start_switch_fiber().

Parameters
fake_stack_saveFake stack save location.
bottom_old[out] Bottom address of old stack.
size_old[out] Size of old stack in bytes.

◆ __sanitizer_get_module_and_offset_for_pc()

int __sanitizer_get_module_and_offset_for_pc ( void *  pc,
char *  module_path,
size_t  module_path_len,
void **  pc_offset 
)

◆ __sanitizer_print_memory_profile()

void __sanitizer_print_memory_profile ( size_t  top_percent,
size_t  max_number_of_contexts 
)

◆ __sanitizer_print_stack_trace()

void __sanitizer_print_stack_trace ( void  )

Prints the stack trace leading to this call (useful for calling from the debugger).

◆ __sanitizer_report_error_summary()

void __sanitizer_report_error_summary ( const char *  error_summary)

◆ __sanitizer_sandbox_on_notify()

void __sanitizer_sandbox_on_notify ( __sanitizer_sandbox_arguments args)

◆ __sanitizer_set_death_callback()

void __sanitizer_set_death_callback ( void(*)(void)  callback)

Sets the callback to be called immediately before death on error.

Passing 0 will unset the callback.

Parameters
callbackUser-provided callback.

◆ __sanitizer_set_report_fd()

void __sanitizer_set_report_fd ( void *  fd)

◆ __sanitizer_set_report_path()

void __sanitizer_set_report_path ( const char *  path)

◆ __sanitizer_start_switch_fiber()

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.
bottomBottom address of stack.
sizeSize of stack in bytes.

◆ __sanitizer_symbolize_global()

void __sanitizer_symbolize_global ( void *  data_ptr,
const char *  fmt,
char *  out_buf,
size_t  out_buf_size 
)

◆ __sanitizer_symbolize_pc()

void __sanitizer_symbolize_pc ( void *  pc,
const char *  fmt,
char *  out_buf,
size_t  out_buf_size 
)

◆ __sanitizer_unaligned_load16()

uint16_t __sanitizer_unaligned_load16 ( const void *  p)

Loads a 16-bit unaligned value.

Parameters
pPointer to unaligned memory.
Returns
Loaded value.

◆ __sanitizer_unaligned_load32()

uint32_t __sanitizer_unaligned_load32 ( const void *  p)

Loads a 32-bit unaligned value.

Parameters
pPointer to unaligned memory.
Returns
Loaded value.

◆ __sanitizer_unaligned_load64()

uint64_t __sanitizer_unaligned_load64 ( const void *  p)

Loads a 64-bit unaligned value.

Parameters
pPointer to unaligned memory.
Returns
Loaded value.

◆ __sanitizer_unaligned_store16()

void __sanitizer_unaligned_store16 ( void *  p,
uint16_t  x 
)

Stores a 16-bit unaligned value.

Parameters
pPointer to unaligned memory.
x16-bit value to store.

◆ __sanitizer_unaligned_store32()

void __sanitizer_unaligned_store32 ( void *  p,
uint32_t  x 
)

Stores a 32-bit unaligned value.

Parameters
pPointer to unaligned memory.
x32-bit value to store.

◆ __sanitizer_unaligned_store64()

void __sanitizer_unaligned_store64 ( void *  p,
uint64_t  x 
)

Stores a 64-bit unaligned value.

Parameters
pPointer to unaligned memory.
x64-bit value to store.

◆ __sanitizer_verify_contiguous_container()

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
begBeginning of memory region.
midMiddle of memory region.
endOld end of memory region.
Returns
True if the contiguous container [beg, end) is properly poisoned.

◆ __sanitizer_weak_hook_memcmp()

void __sanitizer_weak_hook_memcmp ( void *  called_pc,
const void *  s1,
const void *  s2,
size_t  n,
int  result 
)

Interceptor hook for memcmp().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
nNumber of bytes to compare.
resultValue returned by the intercepted function.

◆ __sanitizer_weak_hook_memmem()

void __sanitizer_weak_hook_memmem ( void *  called_pc,
const void *  s1,
size_t  len1,
const void *  s2,
size_t  len2,
void *  result 
)

◆ __sanitizer_weak_hook_strcasecmp()

void __sanitizer_weak_hook_strcasecmp ( void *  called_pc,
const char *  s1,
const char *  s2,
int  result 
)

Interceptor hook for strcasecmp().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
resultValue returned by the intercepted function.

◆ __sanitizer_weak_hook_strcasestr()

void __sanitizer_weak_hook_strcasestr ( void *  called_pc,
const char *  s1,
const char *  s2,
char *  result 
)

◆ __sanitizer_weak_hook_strcmp()

void __sanitizer_weak_hook_strcmp ( void *  called_pc,
const char *  s1,
const char *  s2,
int  result 
)

Interceptor hook for strcmp().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
resultValue returned by the intercepted function.

◆ __sanitizer_weak_hook_strncasecmp()

void __sanitizer_weak_hook_strncasecmp ( void *  called_pc,
const char *  s1,
const char *  s2,
size_t  n,
int  result 
)

Interceptor hook for strncasecmp().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
nNumber of bytes to compare.
resultValue returned by the intercepted function.

◆ __sanitizer_weak_hook_strncmp()

void __sanitizer_weak_hook_strncmp ( void *  called_pc,
const char *  s1,
const char *  s2,
size_t  n,
int  result 
)

Interceptor hook for strncmp().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
nNumber of bytes to compare.
resultValue returned by the intercepted function.

◆ __sanitizer_weak_hook_strstr()

void __sanitizer_weak_hook_strstr ( void *  called_pc,
const char *  s1,
const char *  s2,
char *  result 
)

Interceptor hook for strstr().

Parameters
called_pcPC (program counter) address of the original call.
s1Pointer to block of memory.
s2Pointer to block of memory.
resultValue returned by the intercepted function.