static void kasan_report_error(struct kasan_access_info *info) { unsigned long flags; const char *bug_type; kasan_start_report(&flags); if (info->access_addr < kasan_shadow_to_mem((void *)KASAN_SHADOW_START)) { if ((unsigned long)info->access_addr < PAGE_SIZE) bug_type = "null-ptr-deref"; else if ((unsigned long)info->access_addr < TASK_SIZE) bug_type = "user-memory-access"; else bug_type = "wild-memory-access"; pr_err("BUG: KASAN: %s on address %p\n", bug_type, info->access_addr); pr_err("%s of size %zu by task %s/%d\n", info->is_write ? "Write" : "Read", info->access_size, current->comm, task_pid_nr(current)); dump_stack(); } else { print_error_description(info); print_address_description(info); print_shadow_for_address(info->first_bad_addr); } kasan_end_report(&flags); }
void kasan_report_double_free(struct kmem_cache *cache, void *object, s8 shadow) { unsigned long flags; kasan_start_report(&flags); pr_err("BUG: Double free or freeing an invalid pointer\n"); pr_err("Unexpected shadow byte: 0x%hhX\n", shadow); kasan_object_err(cache, object); kasan_end_report(&flags); }
void kasan_report_invalid_free(void *object, unsigned long ip) { unsigned long flags; kasan_start_report(&flags); pr_err("BUG: KASAN: double-free or invalid-free in %pS\n", (void *)ip); pr_err("\n"); print_address_description(object); pr_err("\n"); print_shadow_for_address(object); kasan_end_report(&flags); }
static void kasan_report_error(struct kasan_access_info *info) { unsigned long flags; kasan_start_report(&flags); print_error_description(info); pr_err("\n"); if (!addr_has_shadow(info)) { dump_stack(); } else { print_address_description((void *)info->access_addr); pr_err("\n"); print_shadow_for_address(info->first_bad_addr); } kasan_end_report(&flags); }