xref: /openbmc/linux/mm/kasan/kasan.h (revision 62a9bbf2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __MM_KASAN_KASAN_H
3 #define __MM_KASAN_KASAN_H
4 
5 #include <linux/atomic.h>
6 #include <linux/kasan.h>
7 #include <linux/kasan-tags.h>
8 #include <linux/kfence.h>
9 #include <linux/stackdepot.h>
10 
11 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
12 
13 #include <linux/static_key.h>
14 
15 DECLARE_STATIC_KEY_TRUE(kasan_flag_stacktrace);
16 
17 static inline bool kasan_stack_collection_enabled(void)
18 {
19 	return static_branch_unlikely(&kasan_flag_stacktrace);
20 }
21 
22 #else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
23 
24 static inline bool kasan_stack_collection_enabled(void)
25 {
26 	return true;
27 }
28 
29 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
30 
31 #ifdef CONFIG_KASAN_HW_TAGS
32 
33 #include "../slab.h"
34 
35 DECLARE_STATIC_KEY_TRUE(kasan_flag_vmalloc);
36 
37 enum kasan_mode {
38 	KASAN_MODE_SYNC,
39 	KASAN_MODE_ASYNC,
40 	KASAN_MODE_ASYMM,
41 };
42 
43 extern enum kasan_mode kasan_mode __ro_after_init;
44 
45 extern unsigned long kasan_page_alloc_sample;
46 extern unsigned int kasan_page_alloc_sample_order;
47 DECLARE_PER_CPU(long, kasan_page_alloc_skip);
48 
49 static inline bool kasan_vmalloc_enabled(void)
50 {
51 	return static_branch_likely(&kasan_flag_vmalloc);
52 }
53 
54 static inline bool kasan_async_fault_possible(void)
55 {
56 	return kasan_mode == KASAN_MODE_ASYNC || kasan_mode == KASAN_MODE_ASYMM;
57 }
58 
59 static inline bool kasan_sync_fault_possible(void)
60 {
61 	return kasan_mode == KASAN_MODE_SYNC || kasan_mode == KASAN_MODE_ASYMM;
62 }
63 
64 static inline bool kasan_sample_page_alloc(unsigned int order)
65 {
66 	/* Fast-path for when sampling is disabled. */
67 	if (kasan_page_alloc_sample == 1)
68 		return true;
69 
70 	if (order < kasan_page_alloc_sample_order)
71 		return true;
72 
73 	if (this_cpu_dec_return(kasan_page_alloc_skip) < 0) {
74 		this_cpu_write(kasan_page_alloc_skip,
75 			       kasan_page_alloc_sample - 1);
76 		return true;
77 	}
78 
79 	return false;
80 }
81 
82 #else /* CONFIG_KASAN_HW_TAGS */
83 
84 static inline bool kasan_async_fault_possible(void)
85 {
86 	return false;
87 }
88 
89 static inline bool kasan_sync_fault_possible(void)
90 {
91 	return true;
92 }
93 
94 static inline bool kasan_sample_page_alloc(unsigned int order)
95 {
96 	return true;
97 }
98 
99 #endif /* CONFIG_KASAN_HW_TAGS */
100 
101 #ifdef CONFIG_KASAN_GENERIC
102 
103 /* Generic KASAN uses per-object metadata to store stack traces. */
104 static inline bool kasan_requires_meta(void)
105 {
106 	/*
107 	 * Technically, Generic KASAN always collects stack traces right now.
108 	 * However, let's use kasan_stack_collection_enabled() in case the
109 	 * kasan.stacktrace command-line argument is changed to affect
110 	 * Generic KASAN.
111 	 */
112 	return kasan_stack_collection_enabled();
113 }
114 
115 #else /* CONFIG_KASAN_GENERIC */
116 
117 /* Tag-based KASAN modes do not use per-object metadata. */
118 static inline bool kasan_requires_meta(void)
119 {
120 	return false;
121 }
122 
123 #endif /* CONFIG_KASAN_GENERIC */
124 
125 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
126 #define KASAN_GRANULE_SIZE	(1UL << KASAN_SHADOW_SCALE_SHIFT)
127 #else
128 #include <asm/mte-kasan.h>
129 #define KASAN_GRANULE_SIZE	MTE_GRANULE_SIZE
130 #endif
131 
132 #define KASAN_GRANULE_MASK	(KASAN_GRANULE_SIZE - 1)
133 
134 #define KASAN_MEMORY_PER_SHADOW_PAGE	(KASAN_GRANULE_SIZE << PAGE_SHIFT)
135 
136 #ifdef CONFIG_KASAN_GENERIC
137 #define KASAN_PAGE_FREE		0xFF  /* freed page */
138 #define KASAN_PAGE_REDZONE	0xFE  /* redzone for kmalloc_large allocation */
139 #define KASAN_SLAB_REDZONE	0xFC  /* redzone for slab object */
140 #define KASAN_SLAB_FREE		0xFB  /* freed slab object */
141 #define KASAN_VMALLOC_INVALID	0xF8  /* inaccessible space in vmap area */
142 #else
143 #define KASAN_PAGE_FREE		KASAN_TAG_INVALID
144 #define KASAN_PAGE_REDZONE	KASAN_TAG_INVALID
145 #define KASAN_SLAB_REDZONE	KASAN_TAG_INVALID
146 #define KASAN_SLAB_FREE		KASAN_TAG_INVALID
147 #define KASAN_VMALLOC_INVALID	KASAN_TAG_INVALID /* only used for SW_TAGS */
148 #endif
149 
150 #ifdef CONFIG_KASAN_GENERIC
151 
152 #define KASAN_SLAB_FREETRACK	0xFA  /* freed slab object with free track */
153 #define KASAN_GLOBAL_REDZONE	0xF9  /* redzone for global variable */
154 
155 /* Stack redzone shadow values. Compiler ABI, do not change. */
156 #define KASAN_STACK_LEFT	0xF1
157 #define KASAN_STACK_MID		0xF2
158 #define KASAN_STACK_RIGHT	0xF3
159 #define KASAN_STACK_PARTIAL	0xF4
160 
161 /* alloca redzone shadow values. */
162 #define KASAN_ALLOCA_LEFT	0xCA
163 #define KASAN_ALLOCA_RIGHT	0xCB
164 
165 /* alloca redzone size. Compiler ABI, do not change. */
166 #define KASAN_ALLOCA_REDZONE_SIZE	32
167 
168 /* Stack frame marker. Compiler ABI, do not change. */
169 #define KASAN_CURRENT_STACK_FRAME_MAGIC 0x41B58AB3
170 
171 /* Dummy value to avoid breaking randconfig/all*config builds. */
172 #ifndef KASAN_ABI_VERSION
173 #define KASAN_ABI_VERSION 1
174 #endif
175 
176 #endif /* CONFIG_KASAN_GENERIC */
177 
178 /* Metadata layout customization. */
179 #define META_BYTES_PER_BLOCK 1
180 #define META_BLOCKS_PER_ROW 16
181 #define META_BYTES_PER_ROW (META_BLOCKS_PER_ROW * META_BYTES_PER_BLOCK)
182 #define META_MEM_BYTES_PER_ROW (META_BYTES_PER_ROW * KASAN_GRANULE_SIZE)
183 #define META_ROWS_AROUND_ADDR 2
184 
185 #define KASAN_STACK_DEPTH 64
186 
187 struct kasan_track {
188 	u32 pid;
189 	depot_stack_handle_t stack;
190 };
191 
192 enum kasan_report_type {
193 	KASAN_REPORT_ACCESS,
194 	KASAN_REPORT_INVALID_FREE,
195 	KASAN_REPORT_DOUBLE_FREE,
196 };
197 
198 struct kasan_report_info {
199 	/* Filled in by kasan_report_*(). */
200 	enum kasan_report_type type;
201 	void *access_addr;
202 	size_t access_size;
203 	bool is_write;
204 	unsigned long ip;
205 
206 	/* Filled in by the common reporting code. */
207 	void *first_bad_addr;
208 	struct kmem_cache *cache;
209 	void *object;
210 
211 	/* Filled in by the mode-specific reporting code. */
212 	const char *bug_type;
213 	struct kasan_track alloc_track;
214 	struct kasan_track free_track;
215 };
216 
217 /* Do not change the struct layout: compiler ABI. */
218 struct kasan_source_location {
219 	const char *filename;
220 	int line_no;
221 	int column_no;
222 };
223 
224 /* Do not change the struct layout: compiler ABI. */
225 struct kasan_global {
226 	const void *beg;		/* Address of the beginning of the global variable. */
227 	size_t size;			/* Size of the global variable. */
228 	size_t size_with_redzone;	/* Size of the variable + size of the redzone. 32 bytes aligned. */
229 	const void *name;
230 	const void *module_name;	/* Name of the module where the global variable is declared. */
231 	unsigned long has_dynamic_init;	/* This is needed for C++. */
232 #if KASAN_ABI_VERSION >= 4
233 	struct kasan_source_location *location;
234 #endif
235 #if KASAN_ABI_VERSION >= 5
236 	char *odr_indicator;
237 #endif
238 };
239 
240 /* Structures for keeping alloc and free meta. */
241 
242 #ifdef CONFIG_KASAN_GENERIC
243 
244 struct kasan_alloc_meta {
245 	struct kasan_track alloc_track;
246 	/* Free track is stored in kasan_free_meta. */
247 	depot_stack_handle_t aux_stack[2];
248 };
249 
250 struct qlist_node {
251 	struct qlist_node *next;
252 };
253 
254 /*
255  * Free meta is stored either in the object itself or in the redzone after the
256  * object. In the former case, free meta offset is 0. In the latter case, the
257  * offset is between 0 and INT_MAX. INT_MAX marks that free meta is not present.
258  */
259 #define KASAN_NO_FREE_META INT_MAX
260 
261 /*
262  * Free meta is only used by Generic mode while the object is in quarantine.
263  * After that, slab allocator stores the freelist pointer in the object.
264  */
265 struct kasan_free_meta {
266 	struct qlist_node quarantine_link;
267 	struct kasan_track free_track;
268 };
269 
270 #endif /* CONFIG_KASAN_GENERIC */
271 
272 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
273 
274 struct kasan_stack_ring_entry {
275 	void *ptr;
276 	size_t size;
277 	u32 pid;
278 	depot_stack_handle_t stack;
279 	bool is_free;
280 };
281 
282 struct kasan_stack_ring {
283 	rwlock_t lock;
284 	size_t size;
285 	atomic64_t pos;
286 	struct kasan_stack_ring_entry *entries;
287 };
288 
289 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
290 
291 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
292 
293 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
294 {
295 	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
296 		<< KASAN_SHADOW_SCALE_SHIFT);
297 }
298 
299 static inline bool addr_has_metadata(const void *addr)
300 {
301 	return (kasan_reset_tag(addr) >=
302 		kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
303 }
304 
305 /**
306  * kasan_check_range - Check memory region, and report if invalid access.
307  * @addr: the accessed address
308  * @size: the accessed size
309  * @write: true if access is a write access
310  * @ret_ip: return address
311  * @return: true if access was valid, false if invalid
312  */
313 bool kasan_check_range(unsigned long addr, size_t size, bool write,
314 				unsigned long ret_ip);
315 
316 #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
317 
318 static inline bool addr_has_metadata(const void *addr)
319 {
320 	return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
321 }
322 
323 #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
324 
325 void *kasan_find_first_bad_addr(void *addr, size_t size);
326 void kasan_complete_mode_report_info(struct kasan_report_info *info);
327 void kasan_metadata_fetch_row(char *buffer, void *row);
328 
329 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
330 void kasan_print_tags(u8 addr_tag, const void *addr);
331 #else
332 static inline void kasan_print_tags(u8 addr_tag, const void *addr) { }
333 #endif
334 
335 #if defined(CONFIG_KASAN_STACK)
336 void kasan_print_address_stack_frame(const void *addr);
337 #else
338 static inline void kasan_print_address_stack_frame(const void *addr) { }
339 #endif
340 
341 #ifdef CONFIG_KASAN_GENERIC
342 void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object);
343 #else
344 static inline void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object) { }
345 #endif
346 
347 bool kasan_report(unsigned long addr, size_t size,
348 		bool is_write, unsigned long ip);
349 void kasan_report_invalid_free(void *object, unsigned long ip, enum kasan_report_type type);
350 
351 struct slab *kasan_addr_to_slab(const void *addr);
352 
353 #ifdef CONFIG_KASAN_GENERIC
354 void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size);
355 void kasan_init_object_meta(struct kmem_cache *cache, const void *object);
356 struct kasan_alloc_meta *kasan_get_alloc_meta(struct kmem_cache *cache,
357 						const void *object);
358 struct kasan_free_meta *kasan_get_free_meta(struct kmem_cache *cache,
359 						const void *object);
360 #else
361 static inline void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size) { }
362 static inline void kasan_init_object_meta(struct kmem_cache *cache, const void *object) { }
363 #endif
364 
365 depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc);
366 void kasan_set_track(struct kasan_track *track, gfp_t flags);
367 void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags);
368 void kasan_save_free_info(struct kmem_cache *cache, void *object);
369 
370 #if defined(CONFIG_KASAN_GENERIC) && \
371 	(defined(CONFIG_SLAB) || defined(CONFIG_SLUB))
372 bool kasan_quarantine_put(struct kmem_cache *cache, void *object);
373 void kasan_quarantine_reduce(void);
374 void kasan_quarantine_remove_cache(struct kmem_cache *cache);
375 #else
376 static inline bool kasan_quarantine_put(struct kmem_cache *cache, void *object) { return false; }
377 static inline void kasan_quarantine_reduce(void) { }
378 static inline void kasan_quarantine_remove_cache(struct kmem_cache *cache) { }
379 #endif
380 
381 #ifndef arch_kasan_set_tag
382 static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
383 {
384 	return addr;
385 }
386 #endif
387 #ifndef arch_kasan_get_tag
388 #define arch_kasan_get_tag(addr)	0
389 #endif
390 
391 #define set_tag(addr, tag)	((void *)arch_kasan_set_tag((addr), (tag)))
392 #define get_tag(addr)		arch_kasan_get_tag(addr)
393 
394 #ifdef CONFIG_KASAN_HW_TAGS
395 
396 #ifndef arch_enable_tagging_sync
397 #define arch_enable_tagging_sync()
398 #endif
399 #ifndef arch_enable_tagging_async
400 #define arch_enable_tagging_async()
401 #endif
402 #ifndef arch_enable_tagging_asymm
403 #define arch_enable_tagging_asymm()
404 #endif
405 #ifndef arch_force_async_tag_fault
406 #define arch_force_async_tag_fault()
407 #endif
408 #ifndef arch_get_random_tag
409 #define arch_get_random_tag()	(0xFF)
410 #endif
411 #ifndef arch_get_mem_tag
412 #define arch_get_mem_tag(addr)	(0xFF)
413 #endif
414 #ifndef arch_set_mem_tag_range
415 #define arch_set_mem_tag_range(addr, size, tag, init) ((void *)(addr))
416 #endif
417 
418 #define hw_enable_tagging_sync()		arch_enable_tagging_sync()
419 #define hw_enable_tagging_async()		arch_enable_tagging_async()
420 #define hw_enable_tagging_asymm()		arch_enable_tagging_asymm()
421 #define hw_force_async_tag_fault()		arch_force_async_tag_fault()
422 #define hw_get_random_tag()			arch_get_random_tag()
423 #define hw_get_mem_tag(addr)			arch_get_mem_tag(addr)
424 #define hw_set_mem_tag_range(addr, size, tag, init) \
425 			arch_set_mem_tag_range((addr), (size), (tag), (init))
426 
427 void kasan_enable_tagging(void);
428 
429 #else /* CONFIG_KASAN_HW_TAGS */
430 
431 #define hw_enable_tagging_sync()
432 #define hw_enable_tagging_async()
433 #define hw_enable_tagging_asymm()
434 
435 static inline void kasan_enable_tagging(void) { }
436 
437 #endif /* CONFIG_KASAN_HW_TAGS */
438 
439 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
440 void __init kasan_init_tags(void);
441 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
442 
443 #if defined(CONFIG_KASAN_HW_TAGS) && IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
444 
445 void kasan_force_async_fault(void);
446 
447 #else /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
448 
449 static inline void kasan_force_async_fault(void) { }
450 
451 #endif /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
452 
453 #ifdef CONFIG_KASAN_SW_TAGS
454 u8 kasan_random_tag(void);
455 #elif defined(CONFIG_KASAN_HW_TAGS)
456 static inline u8 kasan_random_tag(void) { return hw_get_random_tag(); }
457 #else
458 static inline u8 kasan_random_tag(void) { return 0; }
459 #endif
460 
461 #ifdef CONFIG_KASAN_HW_TAGS
462 
463 static inline void kasan_poison(const void *addr, size_t size, u8 value, bool init)
464 {
465 	addr = kasan_reset_tag(addr);
466 
467 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
468 	if (is_kfence_address(addr))
469 		return;
470 
471 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
472 		return;
473 	if (WARN_ON(size & KASAN_GRANULE_MASK))
474 		return;
475 
476 	hw_set_mem_tag_range((void *)addr, size, value, init);
477 }
478 
479 static inline void kasan_unpoison(const void *addr, size_t size, bool init)
480 {
481 	u8 tag = get_tag(addr);
482 
483 	addr = kasan_reset_tag(addr);
484 
485 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
486 	if (is_kfence_address(addr))
487 		return;
488 
489 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
490 		return;
491 	/*
492 	 * Explicitly initialize the memory with the precise object size to
493 	 * avoid overwriting the slab redzone. This disables initialization in
494 	 * the arch code and may thus lead to performance penalty. This penalty
495 	 * does not affect production builds, as slab redzones are not enabled
496 	 * there.
497 	 */
498 	if (__slub_debug_enabled() &&
499 	    init && ((unsigned long)size & KASAN_GRANULE_MASK)) {
500 		init = false;
501 		memzero_explicit((void *)addr, size);
502 	}
503 	size = round_up(size, KASAN_GRANULE_SIZE);
504 
505 	hw_set_mem_tag_range((void *)addr, size, tag, init);
506 }
507 
508 static inline bool kasan_byte_accessible(const void *addr)
509 {
510 	u8 ptr_tag = get_tag(addr);
511 	u8 mem_tag = hw_get_mem_tag((void *)addr);
512 
513 	return ptr_tag == KASAN_TAG_KERNEL || ptr_tag == mem_tag;
514 }
515 
516 #else /* CONFIG_KASAN_HW_TAGS */
517 
518 /**
519  * kasan_poison - mark the memory range as inaccessible
520  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
521  * @size - range size, must be aligned to KASAN_GRANULE_SIZE
522  * @value - value that's written to metadata for the range
523  * @init - whether to initialize the memory range (only for hardware tag-based)
524  *
525  * The size gets aligned to KASAN_GRANULE_SIZE before marking the range.
526  */
527 void kasan_poison(const void *addr, size_t size, u8 value, bool init);
528 
529 /**
530  * kasan_unpoison - mark the memory range as accessible
531  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
532  * @size - range size, can be unaligned
533  * @init - whether to initialize the memory range (only for hardware tag-based)
534  *
535  * For the tag-based modes, the @size gets aligned to KASAN_GRANULE_SIZE before
536  * marking the range.
537  * For the generic mode, the last granule of the memory range gets partially
538  * unpoisoned based on the @size.
539  */
540 void kasan_unpoison(const void *addr, size_t size, bool init);
541 
542 bool kasan_byte_accessible(const void *addr);
543 
544 #endif /* CONFIG_KASAN_HW_TAGS */
545 
546 #ifdef CONFIG_KASAN_GENERIC
547 
548 /**
549  * kasan_poison_last_granule - mark the last granule of the memory range as
550  * inaccessible
551  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
552  * @size - range size
553  *
554  * This function is only available for the generic mode, as it's the only mode
555  * that has partially poisoned memory granules.
556  */
557 void kasan_poison_last_granule(const void *address, size_t size);
558 
559 #else /* CONFIG_KASAN_GENERIC */
560 
561 static inline void kasan_poison_last_granule(const void *address, size_t size) { }
562 
563 #endif /* CONFIG_KASAN_GENERIC */
564 
565 #ifndef kasan_arch_is_ready
566 static inline bool kasan_arch_is_ready(void)	{ return true; }
567 #elif !defined(CONFIG_KASAN_GENERIC) || !defined(CONFIG_KASAN_OUTLINE)
568 #error kasan_arch_is_ready only works in KASAN generic outline mode!
569 #endif
570 
571 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
572 
573 void kasan_kunit_test_suite_start(void);
574 void kasan_kunit_test_suite_end(void);
575 
576 #else /* CONFIG_KASAN_KUNIT_TEST */
577 
578 static inline void kasan_kunit_test_suite_start(void) { }
579 static inline void kasan_kunit_test_suite_end(void) { }
580 
581 #endif /* CONFIG_KASAN_KUNIT_TEST */
582 
583 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) || IS_ENABLED(CONFIG_KASAN_MODULE_TEST)
584 
585 bool kasan_save_enable_multi_shot(void);
586 void kasan_restore_multi_shot(bool enabled);
587 
588 #endif
589 
590 /*
591  * Exported functions for interfaces called from assembly or from generated
592  * code. Declared here to avoid warnings about missing declarations.
593  */
594 
595 asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
596 void __asan_register_globals(struct kasan_global *globals, size_t size);
597 void __asan_unregister_globals(struct kasan_global *globals, size_t size);
598 void __asan_handle_no_return(void);
599 void __asan_alloca_poison(unsigned long addr, size_t size);
600 void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom);
601 
602 void __asan_load1(unsigned long addr);
603 void __asan_store1(unsigned long addr);
604 void __asan_load2(unsigned long addr);
605 void __asan_store2(unsigned long addr);
606 void __asan_load4(unsigned long addr);
607 void __asan_store4(unsigned long addr);
608 void __asan_load8(unsigned long addr);
609 void __asan_store8(unsigned long addr);
610 void __asan_load16(unsigned long addr);
611 void __asan_store16(unsigned long addr);
612 void __asan_loadN(unsigned long addr, size_t size);
613 void __asan_storeN(unsigned long addr, size_t size);
614 
615 void __asan_load1_noabort(unsigned long addr);
616 void __asan_store1_noabort(unsigned long addr);
617 void __asan_load2_noabort(unsigned long addr);
618 void __asan_store2_noabort(unsigned long addr);
619 void __asan_load4_noabort(unsigned long addr);
620 void __asan_store4_noabort(unsigned long addr);
621 void __asan_load8_noabort(unsigned long addr);
622 void __asan_store8_noabort(unsigned long addr);
623 void __asan_load16_noabort(unsigned long addr);
624 void __asan_store16_noabort(unsigned long addr);
625 void __asan_loadN_noabort(unsigned long addr, size_t size);
626 void __asan_storeN_noabort(unsigned long addr, size_t size);
627 
628 void __asan_report_load1_noabort(unsigned long addr);
629 void __asan_report_store1_noabort(unsigned long addr);
630 void __asan_report_load2_noabort(unsigned long addr);
631 void __asan_report_store2_noabort(unsigned long addr);
632 void __asan_report_load4_noabort(unsigned long addr);
633 void __asan_report_store4_noabort(unsigned long addr);
634 void __asan_report_load8_noabort(unsigned long addr);
635 void __asan_report_store8_noabort(unsigned long addr);
636 void __asan_report_load16_noabort(unsigned long addr);
637 void __asan_report_store16_noabort(unsigned long addr);
638 void __asan_report_load_n_noabort(unsigned long addr, size_t size);
639 void __asan_report_store_n_noabort(unsigned long addr, size_t size);
640 
641 void __asan_set_shadow_00(const void *addr, size_t size);
642 void __asan_set_shadow_f1(const void *addr, size_t size);
643 void __asan_set_shadow_f2(const void *addr, size_t size);
644 void __asan_set_shadow_f3(const void *addr, size_t size);
645 void __asan_set_shadow_f5(const void *addr, size_t size);
646 void __asan_set_shadow_f8(const void *addr, size_t size);
647 
648 void __hwasan_load1_noabort(unsigned long addr);
649 void __hwasan_store1_noabort(unsigned long addr);
650 void __hwasan_load2_noabort(unsigned long addr);
651 void __hwasan_store2_noabort(unsigned long addr);
652 void __hwasan_load4_noabort(unsigned long addr);
653 void __hwasan_store4_noabort(unsigned long addr);
654 void __hwasan_load8_noabort(unsigned long addr);
655 void __hwasan_store8_noabort(unsigned long addr);
656 void __hwasan_load16_noabort(unsigned long addr);
657 void __hwasan_store16_noabort(unsigned long addr);
658 void __hwasan_loadN_noabort(unsigned long addr, size_t size);
659 void __hwasan_storeN_noabort(unsigned long addr, size_t size);
660 
661 void __hwasan_tag_memory(unsigned long addr, u8 tag, unsigned long size);
662 
663 #endif /* __MM_KASAN_KASAN_H */
664