41 void *shadow_start, *shadow_end;
46 __builtin_memset(shadow_start,
value, shadow_end - shadow_start);
65 return unlikely(last_accessible_byte >= shadow_value);
97 return (
unsigned long)start;
110 unsigned int prefix = (
unsigned long)start % 8;
112 if (end - start <= 16)
123 words = (end - start) / 8;
143 unsigned long last_byte =
addr + size - 1;
146 if (
unlikely(ret != (
unsigned long)last_shadow ||
155 if (__builtin_constant_p(size)) {
176 const void *first_bad_addr =
addr;
178 while (!shadow_val && first_bad_addr <
addr + size) {
182 return first_bad_addr;
187 const char *bug_type =
"unknown-crash";
189 const void *first_bad_addr;
201 switch (*shadow_addr) {
203 bug_type =
"out-of-bounds";
206 bug_type =
"global-out-of-bounds";
212 bug_type =
"stack-out-of-bounds";
215 bug_type =
"use-after-scope";
218 bug_type =
"unknown-crash";
231 is_write ?
"Write" :
"Read", size, (size > 1 ?
"s" :
""),
237 size_t size,
bool write,
238 unsigned long ret_ip)
265 unsigned long ret_ip)
296 for (i = 0; i < size; i++)
311 static void asan_ctors(
void)
313 extern long __CTOR_LIST__;
315 func_ptr *ctor = (func_ptr *) &__CTOR_LIST__;
319 for (; *ctor != (func_ptr) 0; ctor++)
347 #define DEFINE_ASAN_LOAD_STORE(size) \
348 void __asan_load##size(unsigned long addr) \
350 check_memory_region_inline(addr, size, false, _RET_IP_);\
352 void __asan_load##size##_noabort(unsigned long addr) \
354 check_memory_region_inline(addr, size, false, _RET_IP_);\
356 void __asan_store##size(unsigned long addr) \
358 check_memory_region_inline(addr, size, true, _RET_IP_); \
360 void __asan_store##size##_noabort(unsigned long addr) \
362 check_memory_region_inline(addr, size, true, _RET_IP_); \
395 #define DEFINE_ASAN_SET_SHADOW(byte) \
396 void __asan_set_shadow_##byte(const void *addr, size_t size) \
398 __builtin_memset((void *)addr, 0x##byte, size); \
408 #define DEFINE_ASAN_REPORT_LOAD(size) \
409 void __asan_report_load##size##_noabort(unsigned long addr) \
411 asan_report(addr, size, false, _RET_IP_); \
414 #define DEFINE_ASAN_REPORT_STORE(size) \
415 void __asan_report_store##size##_noabort(unsigned long addr) \
417 asan_report(addr, size, true, _RET_IP_); \
uintptr_t __asan_shadow_offset(uintptr_t addr)
#define DEFINE_ASAN_SET_SHADOW(byte)
static void * asan_mem_to_shadow(const void *addr)
void __asan_storeN_noabort(unsigned long addr, size_t size)
void check_memory_region(unsigned long addr, size_t size, bool write, unsigned long ret_ip)
static const void * asan_shadow_to_mem(const void *shadow_addr)
static __always_inline unsigned long bytes_is_nonzero(const u8 *start, size_t size)
static __always_inline bool memory_is_poisoned_1(unsigned long addr)
static void register_global(struct asan_global *global)
static __always_inline bool memory_is_poisoned_n(unsigned long addr, size_t size)
#define DEFINE_ASAN_REPORT_LOAD(size)
#define DEFINE_ASAN_REPORT_STORE(size)
void __asan_storeN(unsigned long addr, size_t size)
static __always_inline bool memory_is_poisoned(unsigned long addr, size_t size)
void __asan_unpoison_stack_memory(const void *addr, size_t size)
static __always_inline bool memory_is_poisoned_16(unsigned long addr)
void __asan_loadN_noabort(unsigned long addr, size_t size)
static const char * get_shadow_bug_type(const void *addr, size_t size)
void asan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
static __always_inline void check_memory_region_inline(unsigned long addr, size_t size, bool write, unsigned long ret_ip)
static __always_inline unsigned long memory_is_nonzero(const void *start, const void *end)
static void asan_poison_shadow(const void *address, size_t size, u8 value)
void asan_unpoison_shadow(const void *address, size_t size)
void __asan_poison_stack_memory(const void *addr, size_t size)
void __asan_register_globals(struct asan_global *globals, size_t size)
#define DEFINE_ASAN_LOAD_STORE(size)
void __asan_loadN(unsigned long addr, size_t size)
void __asan_unregister_globals(struct asan_global *globals, size_t size)
static const void * find_first_bad_addr(const void *addr, size_t size)
void __asan_handle_no_return(void)
static __always_inline bool memory_is_poisoned_2_4_8(unsigned long addr, unsigned long size)
void __asan_report_load_n_noabort(unsigned long addr, size_t size)
void __asan_report_store_n_noabort(unsigned long addr, size_t size)
#define ASAN_GLOBAL_REDZONE
#define ASAN_SHADOW_SCALE_SHIFT
#define ASAN_USE_AFTER_SCOPE
#define ASAN_SHADOW_SCALE_SIZE
#define ASAN_STACK_PARTIAL
#define assert(statement)
#define printk(level,...)
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
typedef void(X86APIP X86EMU_intrFuncs)(int num)