xref: /openbmc/linux/mm/kasan/report.c (revision 5c5c1f36cedfb51ec291181e71817f7fe7e03ee2)
10b24beccSAndrey Ryabinin /*
20b24beccSAndrey Ryabinin  * This file contains error reporting code.
30b24beccSAndrey Ryabinin  *
40b24beccSAndrey Ryabinin  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
52baf9e89SAndrey Ryabinin  * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com>
60b24beccSAndrey Ryabinin  *
75d0926efSAndrey Konovalov  * Some code borrowed from https://github.com/xairy/kasan-prototype by
80b24beccSAndrey Ryabinin  *        Andrey Konovalov <adech.fo@gmail.com>
90b24beccSAndrey Ryabinin  *
100b24beccSAndrey Ryabinin  * This program is free software; you can redistribute it and/or modify
110b24beccSAndrey Ryabinin  * it under the terms of the GNU General Public License version 2 as
120b24beccSAndrey Ryabinin  * published by the Free Software Foundation.
130b24beccSAndrey Ryabinin  *
140b24beccSAndrey Ryabinin  */
150b24beccSAndrey Ryabinin 
160b24beccSAndrey Ryabinin #include <linux/kernel.h>
170b24beccSAndrey Ryabinin #include <linux/mm.h>
180b24beccSAndrey Ryabinin #include <linux/printk.h>
190b24beccSAndrey Ryabinin #include <linux/sched.h>
200b24beccSAndrey Ryabinin #include <linux/slab.h>
21cd11016eSAlexander Potapenko #include <linux/stackdepot.h>
220b24beccSAndrey Ryabinin #include <linux/stacktrace.h>
230b24beccSAndrey Ryabinin #include <linux/string.h>
240b24beccSAndrey Ryabinin #include <linux/types.h>
250b24beccSAndrey Ryabinin #include <linux/kasan.h>
26527f215bSAneesh Kumar K.V #include <linux/module.h>
270b24beccSAndrey Ryabinin 
28bebf56a1SAndrey Ryabinin #include <asm/sections.h>
29bebf56a1SAndrey Ryabinin 
300b24beccSAndrey Ryabinin #include "kasan.h"
310316bec2SAndrey Ryabinin #include "../slab.h"
320b24beccSAndrey Ryabinin 
330b24beccSAndrey Ryabinin /* Shadow layout customization. */
340b24beccSAndrey Ryabinin #define SHADOW_BYTES_PER_BLOCK 1
350b24beccSAndrey Ryabinin #define SHADOW_BLOCKS_PER_ROW 16
360b24beccSAndrey Ryabinin #define SHADOW_BYTES_PER_ROW (SHADOW_BLOCKS_PER_ROW * SHADOW_BYTES_PER_BLOCK)
370b24beccSAndrey Ryabinin #define SHADOW_ROWS_AROUND_ADDR 2
380b24beccSAndrey Ryabinin 
390b24beccSAndrey Ryabinin static const void *find_first_bad_addr(const void *addr, size_t size)
400b24beccSAndrey Ryabinin {
410b24beccSAndrey Ryabinin 	u8 shadow_val = *(u8 *)kasan_mem_to_shadow(addr);
420b24beccSAndrey Ryabinin 	const void *first_bad_addr = addr;
430b24beccSAndrey Ryabinin 
440b24beccSAndrey Ryabinin 	while (!shadow_val && first_bad_addr < addr + size) {
450b24beccSAndrey Ryabinin 		first_bad_addr += KASAN_SHADOW_SCALE_SIZE;
460b24beccSAndrey Ryabinin 		shadow_val = *(u8 *)kasan_mem_to_shadow(first_bad_addr);
470b24beccSAndrey Ryabinin 	}
480b24beccSAndrey Ryabinin 	return first_bad_addr;
490b24beccSAndrey Ryabinin }
500b24beccSAndrey Ryabinin 
510b24beccSAndrey Ryabinin static void print_error_description(struct kasan_access_info *info)
520b24beccSAndrey Ryabinin {
530952d87fSAndrey Konovalov 	const char *bug_type = "unknown-crash";
54cdf6a273SAndrey Konovalov 	u8 *shadow_addr;
550b24beccSAndrey Ryabinin 
560b24beccSAndrey Ryabinin 	info->first_bad_addr = find_first_bad_addr(info->access_addr,
570b24beccSAndrey Ryabinin 						info->access_size);
580b24beccSAndrey Ryabinin 
59cdf6a273SAndrey Konovalov 	shadow_addr = (u8 *)kasan_mem_to_shadow(info->first_bad_addr);
600b24beccSAndrey Ryabinin 
61cdf6a273SAndrey Konovalov 	/*
62cdf6a273SAndrey Konovalov 	 * If shadow byte value is in [0, KASAN_SHADOW_SCALE_SIZE) we can look
63cdf6a273SAndrey Konovalov 	 * at the next shadow byte to determine the type of the bad access.
64cdf6a273SAndrey Konovalov 	 */
65cdf6a273SAndrey Konovalov 	if (*shadow_addr > 0 && *shadow_addr <= KASAN_SHADOW_SCALE_SIZE - 1)
66cdf6a273SAndrey Konovalov 		shadow_addr++;
67cdf6a273SAndrey Konovalov 
68cdf6a273SAndrey Konovalov 	switch (*shadow_addr) {
690952d87fSAndrey Konovalov 	case 0 ... KASAN_SHADOW_SCALE_SIZE - 1:
70cdf6a273SAndrey Konovalov 		/*
71cdf6a273SAndrey Konovalov 		 * In theory it's still possible to see these shadow values
72cdf6a273SAndrey Konovalov 		 * due to a data race in the kernel code.
73cdf6a273SAndrey Konovalov 		 */
740952d87fSAndrey Konovalov 		bug_type = "out-of-bounds";
75b8c73fc2SAndrey Ryabinin 		break;
760316bec2SAndrey Ryabinin 	case KASAN_PAGE_REDZONE:
770316bec2SAndrey Ryabinin 	case KASAN_KMALLOC_REDZONE:
780952d87fSAndrey Konovalov 		bug_type = "slab-out-of-bounds";
790952d87fSAndrey Konovalov 		break;
80bebf56a1SAndrey Ryabinin 	case KASAN_GLOBAL_REDZONE:
810952d87fSAndrey Konovalov 		bug_type = "global-out-of-bounds";
820b24beccSAndrey Ryabinin 		break;
83c420f167SAndrey Ryabinin 	case KASAN_STACK_LEFT:
84c420f167SAndrey Ryabinin 	case KASAN_STACK_MID:
85c420f167SAndrey Ryabinin 	case KASAN_STACK_RIGHT:
86c420f167SAndrey Ryabinin 	case KASAN_STACK_PARTIAL:
870952d87fSAndrey Konovalov 		bug_type = "stack-out-of-bounds";
880952d87fSAndrey Konovalov 		break;
890952d87fSAndrey Konovalov 	case KASAN_FREE_PAGE:
900952d87fSAndrey Konovalov 	case KASAN_KMALLOC_FREE:
910952d87fSAndrey Konovalov 		bug_type = "use-after-free";
92c420f167SAndrey Ryabinin 		break;
93828347f8SDmitry Vyukov 	case KASAN_USE_AFTER_SCOPE:
94828347f8SDmitry Vyukov 		bug_type = "use-after-scope";
95828347f8SDmitry Vyukov 		break;
960b24beccSAndrey Ryabinin 	}
970b24beccSAndrey Ryabinin 
9825add7ecSAndrey Konovalov 	pr_err("BUG: KASAN: %s in %pS at addr %p\n",
990b24beccSAndrey Ryabinin 		bug_type, (void *)info->ip,
1000b24beccSAndrey Ryabinin 		info->access_addr);
1010b24beccSAndrey Ryabinin 	pr_err("%s of size %zu by task %s/%d\n",
1020b24beccSAndrey Ryabinin 		info->is_write ? "Write" : "Read",
1030b24beccSAndrey Ryabinin 		info->access_size, current->comm, task_pid_nr(current));
1040b24beccSAndrey Ryabinin }
1050b24beccSAndrey Ryabinin 
106bebf56a1SAndrey Ryabinin static inline bool kernel_or_module_addr(const void *addr)
107bebf56a1SAndrey Ryabinin {
108527f215bSAneesh Kumar K.V 	if (addr >= (void *)_stext && addr < (void *)_end)
109527f215bSAneesh Kumar K.V 		return true;
110527f215bSAneesh Kumar K.V 	if (is_module_address((unsigned long)addr))
111527f215bSAneesh Kumar K.V 		return true;
112527f215bSAneesh Kumar K.V 	return false;
113bebf56a1SAndrey Ryabinin }
114bebf56a1SAndrey Ryabinin 
115bebf56a1SAndrey Ryabinin static inline bool init_task_stack_addr(const void *addr)
116bebf56a1SAndrey Ryabinin {
117bebf56a1SAndrey Ryabinin 	return addr >= (void *)&init_thread_union.stack &&
118bebf56a1SAndrey Ryabinin 		(addr <= (void *)&init_thread_union.stack +
119bebf56a1SAndrey Ryabinin 			sizeof(init_thread_union.stack));
120bebf56a1SAndrey Ryabinin }
121bebf56a1SAndrey Ryabinin 
1227e088978SAndrey Ryabinin static DEFINE_SPINLOCK(report_lock);
1237e088978SAndrey Ryabinin 
1247e088978SAndrey Ryabinin static void kasan_start_report(unsigned long *flags)
1257e088978SAndrey Ryabinin {
1267e088978SAndrey Ryabinin 	/*
1277e088978SAndrey Ryabinin 	 * Make sure we don't end up in loop.
1287e088978SAndrey Ryabinin 	 */
1297e088978SAndrey Ryabinin 	kasan_disable_current();
1307e088978SAndrey Ryabinin 	spin_lock_irqsave(&report_lock, *flags);
1317e088978SAndrey Ryabinin 	pr_err("==================================================================\n");
1327e088978SAndrey Ryabinin }
1337e088978SAndrey Ryabinin 
1347e088978SAndrey Ryabinin static void kasan_end_report(unsigned long *flags)
1357e088978SAndrey Ryabinin {
1367e088978SAndrey Ryabinin 	pr_err("==================================================================\n");
1377e088978SAndrey Ryabinin 	add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
1387e088978SAndrey Ryabinin 	spin_unlock_irqrestore(&report_lock, *flags);
139*5c5c1f36SDmitry Vyukov 	if (panic_on_warn)
140*5c5c1f36SDmitry Vyukov 		panic("panic_on_warn set ...\n");
1417e088978SAndrey Ryabinin 	kasan_enable_current();
1427e088978SAndrey Ryabinin }
1437e088978SAndrey Ryabinin 
1447ed2f9e6SAlexander Potapenko static void print_track(struct kasan_track *track)
1457ed2f9e6SAlexander Potapenko {
146cd11016eSAlexander Potapenko 	pr_err("PID = %u\n", track->pid);
147cd11016eSAlexander Potapenko 	if (track->stack) {
148cd11016eSAlexander Potapenko 		struct stack_trace trace;
149cd11016eSAlexander Potapenko 
150cd11016eSAlexander Potapenko 		depot_fetch_stack(track->stack, &trace);
151cd11016eSAlexander Potapenko 		print_stack_trace(&trace, 0);
152cd11016eSAlexander Potapenko 	} else {
153cd11016eSAlexander Potapenko 		pr_err("(stack is not available)\n");
154cd11016eSAlexander Potapenko 	}
1557ed2f9e6SAlexander Potapenko }
1567ed2f9e6SAlexander Potapenko 
1577e088978SAndrey Ryabinin static void kasan_object_err(struct kmem_cache *cache, void *object)
1587ed2f9e6SAlexander Potapenko {
1597ed2f9e6SAlexander Potapenko 	struct kasan_alloc_meta *alloc_info = get_alloc_info(cache, object);
1607ed2f9e6SAlexander Potapenko 
1617ed2f9e6SAlexander Potapenko 	dump_stack();
16247b5c2a0SAndrey Ryabinin 	pr_err("Object at %p, in cache %s size: %d\n", object, cache->name,
16347b5c2a0SAndrey Ryabinin 		cache->object_size);
16447b5c2a0SAndrey Ryabinin 
1657ed2f9e6SAlexander Potapenko 	if (!(cache->flags & SLAB_KASAN))
1667ed2f9e6SAlexander Potapenko 		return;
167b3cbd9bfSAndrey Ryabinin 
168b3cbd9bfSAndrey Ryabinin 	pr_err("Allocated:\n");
169b3cbd9bfSAndrey Ryabinin 	print_track(&alloc_info->alloc_track);
170b3cbd9bfSAndrey Ryabinin 	pr_err("Freed:\n");
171b3cbd9bfSAndrey Ryabinin 	print_track(&alloc_info->free_track);
1727ed2f9e6SAlexander Potapenko }
1737ed2f9e6SAlexander Potapenko 
1747e088978SAndrey Ryabinin void kasan_report_double_free(struct kmem_cache *cache, void *object,
1757e088978SAndrey Ryabinin 			s8 shadow)
1767e088978SAndrey Ryabinin {
1777e088978SAndrey Ryabinin 	unsigned long flags;
1787e088978SAndrey Ryabinin 
1797e088978SAndrey Ryabinin 	kasan_start_report(&flags);
1807e088978SAndrey Ryabinin 	pr_err("BUG: Double free or freeing an invalid pointer\n");
1817e088978SAndrey Ryabinin 	pr_err("Unexpected shadow byte: 0x%hhX\n", shadow);
1827e088978SAndrey Ryabinin 	kasan_object_err(cache, object);
1837e088978SAndrey Ryabinin 	kasan_end_report(&flags);
1847e088978SAndrey Ryabinin }
1857e088978SAndrey Ryabinin 
1860b24beccSAndrey Ryabinin static void print_address_description(struct kasan_access_info *info)
1870b24beccSAndrey Ryabinin {
188b8c73fc2SAndrey Ryabinin 	const void *addr = info->access_addr;
189b8c73fc2SAndrey Ryabinin 
190b8c73fc2SAndrey Ryabinin 	if ((addr >= (void *)PAGE_OFFSET) &&
191b8c73fc2SAndrey Ryabinin 		(addr < high_memory)) {
192b8c73fc2SAndrey Ryabinin 		struct page *page = virt_to_head_page(addr);
1930316bec2SAndrey Ryabinin 
1940316bec2SAndrey Ryabinin 		if (PageSlab(page)) {
1950316bec2SAndrey Ryabinin 			void *object;
1960316bec2SAndrey Ryabinin 			struct kmem_cache *cache = page->slab_cache;
1977ed2f9e6SAlexander Potapenko 			object = nearest_obj(cache, page,
1987ed2f9e6SAlexander Potapenko 						(void *)info->access_addr);
1997e088978SAndrey Ryabinin 			kasan_object_err(cache, object);
2000316bec2SAndrey Ryabinin 			return;
2010316bec2SAndrey Ryabinin 		}
202b8c73fc2SAndrey Ryabinin 		dump_page(page, "kasan: bad access detected");
203b8c73fc2SAndrey Ryabinin 	}
204b8c73fc2SAndrey Ryabinin 
205bebf56a1SAndrey Ryabinin 	if (kernel_or_module_addr(addr)) {
206bebf56a1SAndrey Ryabinin 		if (!init_task_stack_addr(addr))
207bebf56a1SAndrey Ryabinin 			pr_err("Address belongs to variable %pS\n", addr);
208bebf56a1SAndrey Ryabinin 	}
2090b24beccSAndrey Ryabinin 	dump_stack();
2100b24beccSAndrey Ryabinin }
2110b24beccSAndrey Ryabinin 
2120b24beccSAndrey Ryabinin static bool row_is_guilty(const void *row, const void *guilty)
2130b24beccSAndrey Ryabinin {
2140b24beccSAndrey Ryabinin 	return (row <= guilty) && (guilty < row + SHADOW_BYTES_PER_ROW);
2150b24beccSAndrey Ryabinin }
2160b24beccSAndrey Ryabinin 
2170b24beccSAndrey Ryabinin static int shadow_pointer_offset(const void *row, const void *shadow)
2180b24beccSAndrey Ryabinin {
2190b24beccSAndrey Ryabinin 	/* The length of ">ff00ff00ff00ff00: " is
2200b24beccSAndrey Ryabinin 	 *    3 + (BITS_PER_LONG/8)*2 chars.
2210b24beccSAndrey Ryabinin 	 */
2220b24beccSAndrey Ryabinin 	return 3 + (BITS_PER_LONG/8)*2 + (shadow - row)*2 +
2230b24beccSAndrey Ryabinin 		(shadow - row) / SHADOW_BYTES_PER_BLOCK + 1;
2240b24beccSAndrey Ryabinin }
2250b24beccSAndrey Ryabinin 
2260b24beccSAndrey Ryabinin static void print_shadow_for_address(const void *addr)
2270b24beccSAndrey Ryabinin {
2280b24beccSAndrey Ryabinin 	int i;
2290b24beccSAndrey Ryabinin 	const void *shadow = kasan_mem_to_shadow(addr);
2300b24beccSAndrey Ryabinin 	const void *shadow_row;
2310b24beccSAndrey Ryabinin 
2320b24beccSAndrey Ryabinin 	shadow_row = (void *)round_down((unsigned long)shadow,
2330b24beccSAndrey Ryabinin 					SHADOW_BYTES_PER_ROW)
2340b24beccSAndrey Ryabinin 		- SHADOW_ROWS_AROUND_ADDR * SHADOW_BYTES_PER_ROW;
2350b24beccSAndrey Ryabinin 
2360b24beccSAndrey Ryabinin 	pr_err("Memory state around the buggy address:\n");
2370b24beccSAndrey Ryabinin 
2380b24beccSAndrey Ryabinin 	for (i = -SHADOW_ROWS_AROUND_ADDR; i <= SHADOW_ROWS_AROUND_ADDR; i++) {
2390b24beccSAndrey Ryabinin 		const void *kaddr = kasan_shadow_to_mem(shadow_row);
2400b24beccSAndrey Ryabinin 		char buffer[4 + (BITS_PER_LONG/8)*2];
241f2377d4eSAneesh Kumar K.V 		char shadow_buf[SHADOW_BYTES_PER_ROW];
2420b24beccSAndrey Ryabinin 
2430b24beccSAndrey Ryabinin 		snprintf(buffer, sizeof(buffer),
2440b24beccSAndrey Ryabinin 			(i == 0) ? ">%p: " : " %p: ", kaddr);
245f2377d4eSAneesh Kumar K.V 		/*
246f2377d4eSAneesh Kumar K.V 		 * We should not pass a shadow pointer to generic
247f2377d4eSAneesh Kumar K.V 		 * function, because generic functions may try to
248f2377d4eSAneesh Kumar K.V 		 * access kasan mapping for the passed address.
249f2377d4eSAneesh Kumar K.V 		 */
250f2377d4eSAneesh Kumar K.V 		memcpy(shadow_buf, shadow_row, SHADOW_BYTES_PER_ROW);
2510b24beccSAndrey Ryabinin 		print_hex_dump(KERN_ERR, buffer,
2520b24beccSAndrey Ryabinin 			DUMP_PREFIX_NONE, SHADOW_BYTES_PER_ROW, 1,
253f2377d4eSAneesh Kumar K.V 			shadow_buf, SHADOW_BYTES_PER_ROW, 0);
2540b24beccSAndrey Ryabinin 
2550b24beccSAndrey Ryabinin 		if (row_is_guilty(shadow_row, shadow))
2560b24beccSAndrey Ryabinin 			pr_err("%*c\n",
2570b24beccSAndrey Ryabinin 				shadow_pointer_offset(shadow_row, shadow),
2580b24beccSAndrey Ryabinin 				'^');
2590b24beccSAndrey Ryabinin 
2600b24beccSAndrey Ryabinin 		shadow_row += SHADOW_BYTES_PER_ROW;
2610b24beccSAndrey Ryabinin 	}
2620b24beccSAndrey Ryabinin }
2630b24beccSAndrey Ryabinin 
264e9121076SAndrey Konovalov static void kasan_report_error(struct kasan_access_info *info)
2650b24beccSAndrey Ryabinin {
2660b24beccSAndrey Ryabinin 	unsigned long flags;
267e9121076SAndrey Konovalov 	const char *bug_type;
2680b24beccSAndrey Ryabinin 
2697e088978SAndrey Ryabinin 	kasan_start_report(&flags);
2707e088978SAndrey Ryabinin 
271e9121076SAndrey Konovalov 	if (info->access_addr <
272e9121076SAndrey Konovalov 			kasan_shadow_to_mem((void *)KASAN_SHADOW_START)) {
273e9121076SAndrey Konovalov 		if ((unsigned long)info->access_addr < PAGE_SIZE)
274e9121076SAndrey Konovalov 			bug_type = "null-ptr-deref";
275e9121076SAndrey Konovalov 		else if ((unsigned long)info->access_addr < TASK_SIZE)
276e9121076SAndrey Konovalov 			bug_type = "user-memory-access";
277e9121076SAndrey Konovalov 		else
278e9121076SAndrey Konovalov 			bug_type = "wild-memory-access";
27925add7ecSAndrey Konovalov 		pr_err("BUG: KASAN: %s on address %p\n",
280e9121076SAndrey Konovalov 			bug_type, info->access_addr);
281e9121076SAndrey Konovalov 		pr_err("%s of size %zu by task %s/%d\n",
282e9121076SAndrey Konovalov 			info->is_write ? "Write" : "Read",
283e9121076SAndrey Konovalov 			info->access_size, current->comm,
284e9121076SAndrey Konovalov 			task_pid_nr(current));
285e9121076SAndrey Konovalov 		dump_stack();
286e9121076SAndrey Konovalov 	} else {
2870b24beccSAndrey Ryabinin 		print_error_description(info);
2880b24beccSAndrey Ryabinin 		print_address_description(info);
2890b24beccSAndrey Ryabinin 		print_shadow_for_address(info->first_bad_addr);
2900b24beccSAndrey Ryabinin 	}
2917e088978SAndrey Ryabinin 
2927e088978SAndrey Ryabinin 	kasan_end_report(&flags);
2930b24beccSAndrey Ryabinin }
2940b24beccSAndrey Ryabinin 
2950b24beccSAndrey Ryabinin void kasan_report(unsigned long addr, size_t size,
2960b24beccSAndrey Ryabinin 		bool is_write, unsigned long ip)
2970b24beccSAndrey Ryabinin {
2980b24beccSAndrey Ryabinin 	struct kasan_access_info info;
2990b24beccSAndrey Ryabinin 
3000ba8663cSAneesh Kumar K.V 	if (likely(!kasan_report_enabled()))
3010b24beccSAndrey Ryabinin 		return;
3020b24beccSAndrey Ryabinin 
3030b24beccSAndrey Ryabinin 	info.access_addr = (void *)addr;
3040b24beccSAndrey Ryabinin 	info.access_size = size;
3050b24beccSAndrey Ryabinin 	info.is_write = is_write;
3060b24beccSAndrey Ryabinin 	info.ip = ip;
307e9121076SAndrey Konovalov 
3080b24beccSAndrey Ryabinin 	kasan_report_error(&info);
3090b24beccSAndrey Ryabinin }
3100b24beccSAndrey Ryabinin 
3110b24beccSAndrey Ryabinin 
3120b24beccSAndrey Ryabinin #define DEFINE_ASAN_REPORT_LOAD(size)                     \
3130b24beccSAndrey Ryabinin void __asan_report_load##size##_noabort(unsigned long addr) \
3140b24beccSAndrey Ryabinin {                                                         \
3150b24beccSAndrey Ryabinin 	kasan_report(addr, size, false, _RET_IP_);	  \
3160b24beccSAndrey Ryabinin }                                                         \
3170b24beccSAndrey Ryabinin EXPORT_SYMBOL(__asan_report_load##size##_noabort)
3180b24beccSAndrey Ryabinin 
3190b24beccSAndrey Ryabinin #define DEFINE_ASAN_REPORT_STORE(size)                     \
3200b24beccSAndrey Ryabinin void __asan_report_store##size##_noabort(unsigned long addr) \
3210b24beccSAndrey Ryabinin {                                                          \
3220b24beccSAndrey Ryabinin 	kasan_report(addr, size, true, _RET_IP_);	   \
3230b24beccSAndrey Ryabinin }                                                          \
3240b24beccSAndrey Ryabinin EXPORT_SYMBOL(__asan_report_store##size##_noabort)
3250b24beccSAndrey Ryabinin 
3260b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_LOAD(1);
3270b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_LOAD(2);
3280b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_LOAD(4);
3290b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_LOAD(8);
3300b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_LOAD(16);
3310b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_STORE(1);
3320b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_STORE(2);
3330b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_STORE(4);
3340b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_STORE(8);
3350b24beccSAndrey Ryabinin DEFINE_ASAN_REPORT_STORE(16);
3360b24beccSAndrey Ryabinin 
3370b24beccSAndrey Ryabinin void __asan_report_load_n_noabort(unsigned long addr, size_t size)
3380b24beccSAndrey Ryabinin {
3390b24beccSAndrey Ryabinin 	kasan_report(addr, size, false, _RET_IP_);
3400b24beccSAndrey Ryabinin }
3410b24beccSAndrey Ryabinin EXPORT_SYMBOL(__asan_report_load_n_noabort);
3420b24beccSAndrey Ryabinin 
3430b24beccSAndrey Ryabinin void __asan_report_store_n_noabort(unsigned long addr, size_t size)
3440b24beccSAndrey Ryabinin {
3450b24beccSAndrey Ryabinin 	kasan_report(addr, size, true, _RET_IP_);
3460b24beccSAndrey Ryabinin }
3470b24beccSAndrey Ryabinin EXPORT_SYMBOL(__asan_report_store_n_noabort);
348