xref: /openbmc/linux/mm/kasan/kasan.h (revision 3bf90eca)
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 static inline bool kasan_vmalloc_enabled(void)
46 {
47 	return static_branch_likely(&kasan_flag_vmalloc);
48 }
49 
50 static inline bool kasan_async_fault_possible(void)
51 {
52 	return kasan_mode == KASAN_MODE_ASYNC || kasan_mode == KASAN_MODE_ASYMM;
53 }
54 
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 
62 static inline bool kasan_async_fault_possible(void)
63 {
64 	return false;
65 }
66 
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. */
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. */
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 defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
265 
266 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
267 {
268 	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
269 		<< KASAN_SHADOW_SCALE_SHIFT);
270 }
271 
272 static inline bool addr_has_metadata(const void *addr)
273 {
274 	return (kasan_reset_tag(addr) >=
275 		kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
276 }
277 
278 /**
279  * kasan_check_range - Check memory region, and report if invalid access.
280  * @addr: the accessed address
281  * @size: the accessed size
282  * @write: true if access is a write access
283  * @ret_ip: return address
284  * @return: true if access was valid, false if invalid
285  */
286 bool kasan_check_range(unsigned long addr, size_t size, bool write,
287 				unsigned long ret_ip);
288 
289 #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
290 
291 static inline bool addr_has_metadata(const void *addr)
292 {
293 	return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
294 }
295 
296 #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
297 
298 void *kasan_find_first_bad_addr(void *addr, size_t size);
299 void kasan_complete_mode_report_info(struct kasan_report_info *info);
300 void kasan_metadata_fetch_row(char *buffer, void *row);
301 
302 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
303 void kasan_print_tags(u8 addr_tag, const void *addr);
304 #else
305 static inline void kasan_print_tags(u8 addr_tag, const void *addr) { }
306 #endif
307 
308 #if defined(CONFIG_KASAN_STACK)
309 void kasan_print_address_stack_frame(const void *addr);
310 #else
311 static inline void kasan_print_address_stack_frame(const void *addr) { }
312 #endif
313 
314 #ifdef CONFIG_KASAN_GENERIC
315 void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object);
316 #else
317 static inline void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object) { }
318 #endif
319 
320 bool kasan_report(unsigned long addr, size_t size,
321 		bool is_write, unsigned long ip);
322 void kasan_report_invalid_free(void *object, unsigned long ip, enum kasan_report_type type);
323 
324 struct slab *kasan_addr_to_slab(const void *addr);
325 
326 #ifdef CONFIG_KASAN_GENERIC
327 void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size);
328 void kasan_init_object_meta(struct kmem_cache *cache, const void *object);
329 struct kasan_alloc_meta *kasan_get_alloc_meta(struct kmem_cache *cache,
330 						const void *object);
331 struct kasan_free_meta *kasan_get_free_meta(struct kmem_cache *cache,
332 						const void *object);
333 #else
334 static inline void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size) { }
335 static inline void kasan_init_object_meta(struct kmem_cache *cache, const void *object) { }
336 #endif
337 
338 depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc);
339 void kasan_set_track(struct kasan_track *track, gfp_t flags);
340 void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags);
341 void kasan_save_free_info(struct kmem_cache *cache, void *object);
342 
343 #if defined(CONFIG_KASAN_GENERIC) && \
344 	(defined(CONFIG_SLAB) || defined(CONFIG_SLUB))
345 bool kasan_quarantine_put(struct kmem_cache *cache, void *object);
346 void kasan_quarantine_reduce(void);
347 void kasan_quarantine_remove_cache(struct kmem_cache *cache);
348 #else
349 static inline bool kasan_quarantine_put(struct kmem_cache *cache, void *object) { return false; }
350 static inline void kasan_quarantine_reduce(void) { }
351 static inline void kasan_quarantine_remove_cache(struct kmem_cache *cache) { }
352 #endif
353 
354 #ifndef arch_kasan_set_tag
355 static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
356 {
357 	return addr;
358 }
359 #endif
360 #ifndef arch_kasan_get_tag
361 #define arch_kasan_get_tag(addr)	0
362 #endif
363 
364 #define set_tag(addr, tag)	((void *)arch_kasan_set_tag((addr), (tag)))
365 #define get_tag(addr)		arch_kasan_get_tag(addr)
366 
367 #ifdef CONFIG_KASAN_HW_TAGS
368 
369 #ifndef arch_enable_tagging_sync
370 #define arch_enable_tagging_sync()
371 #endif
372 #ifndef arch_enable_tagging_async
373 #define arch_enable_tagging_async()
374 #endif
375 #ifndef arch_enable_tagging_asymm
376 #define arch_enable_tagging_asymm()
377 #endif
378 #ifndef arch_force_async_tag_fault
379 #define arch_force_async_tag_fault()
380 #endif
381 #ifndef arch_get_random_tag
382 #define arch_get_random_tag()	(0xFF)
383 #endif
384 #ifndef arch_get_mem_tag
385 #define arch_get_mem_tag(addr)	(0xFF)
386 #endif
387 #ifndef arch_set_mem_tag_range
388 #define arch_set_mem_tag_range(addr, size, tag, init) ((void *)(addr))
389 #endif
390 
391 #define hw_enable_tagging_sync()		arch_enable_tagging_sync()
392 #define hw_enable_tagging_async()		arch_enable_tagging_async()
393 #define hw_enable_tagging_asymm()		arch_enable_tagging_asymm()
394 #define hw_force_async_tag_fault()		arch_force_async_tag_fault()
395 #define hw_get_random_tag()			arch_get_random_tag()
396 #define hw_get_mem_tag(addr)			arch_get_mem_tag(addr)
397 #define hw_set_mem_tag_range(addr, size, tag, init) \
398 			arch_set_mem_tag_range((addr), (size), (tag), (init))
399 
400 void kasan_enable_tagging(void);
401 
402 #else /* CONFIG_KASAN_HW_TAGS */
403 
404 #define hw_enable_tagging_sync()
405 #define hw_enable_tagging_async()
406 #define hw_enable_tagging_asymm()
407 
408 static inline void kasan_enable_tagging(void) { }
409 
410 #endif /* CONFIG_KASAN_HW_TAGS */
411 
412 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
413 void __init kasan_init_tags(void);
414 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
415 
416 #if defined(CONFIG_KASAN_HW_TAGS) && IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
417 
418 void kasan_force_async_fault(void);
419 
420 #else /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
421 
422 static inline void kasan_force_async_fault(void) { }
423 
424 #endif /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
425 
426 #ifdef CONFIG_KASAN_SW_TAGS
427 u8 kasan_random_tag(void);
428 #elif defined(CONFIG_KASAN_HW_TAGS)
429 static inline u8 kasan_random_tag(void) { return hw_get_random_tag(); }
430 #else
431 static inline u8 kasan_random_tag(void) { return 0; }
432 #endif
433 
434 #ifdef CONFIG_KASAN_HW_TAGS
435 
436 static inline void kasan_poison(const void *addr, size_t size, u8 value, bool init)
437 {
438 	addr = kasan_reset_tag(addr);
439 
440 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
441 	if (is_kfence_address(addr))
442 		return;
443 
444 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
445 		return;
446 	if (WARN_ON(size & KASAN_GRANULE_MASK))
447 		return;
448 
449 	hw_set_mem_tag_range((void *)addr, size, value, init);
450 }
451 
452 static inline void kasan_unpoison(const void *addr, size_t size, bool init)
453 {
454 	u8 tag = get_tag(addr);
455 
456 	addr = kasan_reset_tag(addr);
457 
458 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
459 	if (is_kfence_address(addr))
460 		return;
461 
462 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
463 		return;
464 	/*
465 	 * Explicitly initialize the memory with the precise object size to
466 	 * avoid overwriting the slab redzone. This disables initialization in
467 	 * the arch code and may thus lead to performance penalty. This penalty
468 	 * does not affect production builds, as slab redzones are not enabled
469 	 * there.
470 	 */
471 	if (__slub_debug_enabled() &&
472 	    init && ((unsigned long)size & KASAN_GRANULE_MASK)) {
473 		init = false;
474 		memzero_explicit((void *)addr, size);
475 	}
476 	size = round_up(size, KASAN_GRANULE_SIZE);
477 
478 	hw_set_mem_tag_range((void *)addr, size, tag, init);
479 }
480 
481 static inline bool kasan_byte_accessible(const void *addr)
482 {
483 	u8 ptr_tag = get_tag(addr);
484 	u8 mem_tag = hw_get_mem_tag((void *)addr);
485 
486 	return ptr_tag == KASAN_TAG_KERNEL || ptr_tag == mem_tag;
487 }
488 
489 #else /* CONFIG_KASAN_HW_TAGS */
490 
491 /**
492  * kasan_poison - mark the memory range as inaccessible
493  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
494  * @size - range size, must be aligned to KASAN_GRANULE_SIZE
495  * @value - value that's written to metadata for the range
496  * @init - whether to initialize the memory range (only for hardware tag-based)
497  *
498  * The size gets aligned to KASAN_GRANULE_SIZE before marking the range.
499  */
500 void kasan_poison(const void *addr, size_t size, u8 value, bool init);
501 
502 /**
503  * kasan_unpoison - mark the memory range as accessible
504  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
505  * @size - range size, can be unaligned
506  * @init - whether to initialize the memory range (only for hardware tag-based)
507  *
508  * For the tag-based modes, the @size gets aligned to KASAN_GRANULE_SIZE before
509  * marking the range.
510  * For the generic mode, the last granule of the memory range gets partially
511  * unpoisoned based on the @size.
512  */
513 void kasan_unpoison(const void *addr, size_t size, bool init);
514 
515 bool kasan_byte_accessible(const void *addr);
516 
517 #endif /* CONFIG_KASAN_HW_TAGS */
518 
519 #ifdef CONFIG_KASAN_GENERIC
520 
521 /**
522  * kasan_poison_last_granule - mark the last granule of the memory range as
523  * inaccessible
524  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
525  * @size - range size
526  *
527  * This function is only available for the generic mode, as it's the only mode
528  * that has partially poisoned memory granules.
529  */
530 void kasan_poison_last_granule(const void *address, size_t size);
531 
532 #else /* CONFIG_KASAN_GENERIC */
533 
534 static inline void kasan_poison_last_granule(const void *address, size_t size) { }
535 
536 #endif /* CONFIG_KASAN_GENERIC */
537 
538 #ifndef kasan_arch_is_ready
539 static inline bool kasan_arch_is_ready(void)	{ return true; }
540 #elif !defined(CONFIG_KASAN_GENERIC) || !defined(CONFIG_KASAN_OUTLINE)
541 #error kasan_arch_is_ready only works in KASAN generic outline mode!
542 #endif
543 
544 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
545 
546 void kasan_kunit_test_suite_start(void);
547 void kasan_kunit_test_suite_end(void);
548 
549 #else /* CONFIG_KASAN_KUNIT_TEST */
550 
551 static inline void kasan_kunit_test_suite_start(void) { }
552 static inline void kasan_kunit_test_suite_end(void) { }
553 
554 #endif /* CONFIG_KASAN_KUNIT_TEST */
555 
556 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) || IS_ENABLED(CONFIG_KASAN_MODULE_TEST)
557 
558 bool kasan_save_enable_multi_shot(void);
559 void kasan_restore_multi_shot(bool enabled);
560 
561 #endif
562 
563 /*
564  * Exported functions for interfaces called from assembly or from generated
565  * code. Declared here to avoid warnings about missing declarations.
566  */
567 
568 asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
569 void __asan_register_globals(struct kasan_global *globals, size_t size);
570 void __asan_unregister_globals(struct kasan_global *globals, size_t size);
571 void __asan_handle_no_return(void);
572 void __asan_alloca_poison(unsigned long addr, size_t size);
573 void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom);
574 
575 void __asan_load1(unsigned long addr);
576 void __asan_store1(unsigned long addr);
577 void __asan_load2(unsigned long addr);
578 void __asan_store2(unsigned long addr);
579 void __asan_load4(unsigned long addr);
580 void __asan_store4(unsigned long addr);
581 void __asan_load8(unsigned long addr);
582 void __asan_store8(unsigned long addr);
583 void __asan_load16(unsigned long addr);
584 void __asan_store16(unsigned long addr);
585 void __asan_loadN(unsigned long addr, size_t size);
586 void __asan_storeN(unsigned long addr, size_t size);
587 
588 void __asan_load1_noabort(unsigned long addr);
589 void __asan_store1_noabort(unsigned long addr);
590 void __asan_load2_noabort(unsigned long addr);
591 void __asan_store2_noabort(unsigned long addr);
592 void __asan_load4_noabort(unsigned long addr);
593 void __asan_store4_noabort(unsigned long addr);
594 void __asan_load8_noabort(unsigned long addr);
595 void __asan_store8_noabort(unsigned long addr);
596 void __asan_load16_noabort(unsigned long addr);
597 void __asan_store16_noabort(unsigned long addr);
598 void __asan_loadN_noabort(unsigned long addr, size_t size);
599 void __asan_storeN_noabort(unsigned long addr, size_t size);
600 
601 void __asan_report_load1_noabort(unsigned long addr);
602 void __asan_report_store1_noabort(unsigned long addr);
603 void __asan_report_load2_noabort(unsigned long addr);
604 void __asan_report_store2_noabort(unsigned long addr);
605 void __asan_report_load4_noabort(unsigned long addr);
606 void __asan_report_store4_noabort(unsigned long addr);
607 void __asan_report_load8_noabort(unsigned long addr);
608 void __asan_report_store8_noabort(unsigned long addr);
609 void __asan_report_load16_noabort(unsigned long addr);
610 void __asan_report_store16_noabort(unsigned long addr);
611 void __asan_report_load_n_noabort(unsigned long addr, size_t size);
612 void __asan_report_store_n_noabort(unsigned long addr, size_t size);
613 
614 void __asan_set_shadow_00(const void *addr, size_t size);
615 void __asan_set_shadow_f1(const void *addr, size_t size);
616 void __asan_set_shadow_f2(const void *addr, size_t size);
617 void __asan_set_shadow_f3(const void *addr, size_t size);
618 void __asan_set_shadow_f5(const void *addr, size_t size);
619 void __asan_set_shadow_f8(const void *addr, size_t size);
620 
621 void __hwasan_load1_noabort(unsigned long addr);
622 void __hwasan_store1_noabort(unsigned long addr);
623 void __hwasan_load2_noabort(unsigned long addr);
624 void __hwasan_store2_noabort(unsigned long addr);
625 void __hwasan_load4_noabort(unsigned long addr);
626 void __hwasan_store4_noabort(unsigned long addr);
627 void __hwasan_load8_noabort(unsigned long addr);
628 void __hwasan_store8_noabort(unsigned long addr);
629 void __hwasan_load16_noabort(unsigned long addr);
630 void __hwasan_store16_noabort(unsigned long addr);
631 void __hwasan_loadN_noabort(unsigned long addr, size_t size);
632 void __hwasan_storeN_noabort(unsigned long addr, size_t size);
633 
634 void __hwasan_tag_memory(unsigned long addr, u8 tag, unsigned long size);
635 
636 #endif /* __MM_KASAN_KASAN_H */
637