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