xref: /openbmc/linux/mm/kasan/kasan.h (revision d088d6b6)
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 	const 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 	const void *first_bad_addr;
208 	struct kmem_cache *cache;
209 	void *object;
210 	size_t alloc_size;
211 
212 	/* Filled in by the mode-specific reporting code. */
213 	const char *bug_type;
214 	struct kasan_track alloc_track;
215 	struct kasan_track free_track;
216 };
217 
218 /* Do not change the struct layout: compiler ABI. */
219 struct kasan_source_location {
220 	const char *filename;
221 	int line_no;
222 	int column_no;
223 };
224 
225 /* Do not change the struct layout: compiler ABI. */
226 struct kasan_global {
227 	const void *beg;		/* Address of the beginning of the global variable. */
228 	size_t size;			/* Size of the global variable. */
229 	size_t size_with_redzone;	/* Size of the variable + size of the redzone. 32 bytes aligned. */
230 	const void *name;
231 	const void *module_name;	/* Name of the module where the global variable is declared. */
232 	unsigned long has_dynamic_init;	/* This is needed for C++. */
233 #if KASAN_ABI_VERSION >= 4
234 	struct kasan_source_location *location;
235 #endif
236 #if KASAN_ABI_VERSION >= 5
237 	char *odr_indicator;
238 #endif
239 };
240 
241 /* Structures for keeping alloc and free meta. */
242 
243 #ifdef CONFIG_KASAN_GENERIC
244 
245 struct kasan_alloc_meta {
246 	struct kasan_track alloc_track;
247 	/* Free track is stored in kasan_free_meta. */
248 	depot_stack_handle_t aux_stack[2];
249 };
250 
251 struct qlist_node {
252 	struct qlist_node *next;
253 };
254 
255 /*
256  * Free meta is stored either in the object itself or in the redzone after the
257  * object. In the former case, free meta offset is 0. In the latter case, the
258  * offset is between 0 and INT_MAX. INT_MAX marks that free meta is not present.
259  */
260 #define KASAN_NO_FREE_META INT_MAX
261 
262 /*
263  * Free meta is only used by Generic mode while the object is in quarantine.
264  * After that, slab allocator stores the freelist pointer in the object.
265  */
266 struct kasan_free_meta {
267 	struct qlist_node quarantine_link;
268 	struct kasan_track free_track;
269 };
270 
271 #endif /* CONFIG_KASAN_GENERIC */
272 
273 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
274 
275 struct kasan_stack_ring_entry {
276 	void *ptr;
277 	size_t size;
278 	u32 pid;
279 	depot_stack_handle_t stack;
280 	bool is_free;
281 };
282 
283 struct kasan_stack_ring {
284 	rwlock_t lock;
285 	size_t size;
286 	atomic64_t pos;
287 	struct kasan_stack_ring_entry *entries;
288 };
289 
290 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
291 
292 #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
293 
294 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
295 {
296 	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
297 		<< KASAN_SHADOW_SCALE_SHIFT);
298 }
299 
300 static __always_inline bool addr_has_metadata(const void *addr)
301 {
302 	return (kasan_reset_tag(addr) >=
303 		kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
304 }
305 
306 /**
307  * kasan_check_range - Check memory region, and report if invalid access.
308  * @addr: the accessed address
309  * @size: the accessed size
310  * @write: true if access is a write access
311  * @ret_ip: return address
312  * @return: true if access was valid, false if invalid
313  */
314 bool kasan_check_range(const void *addr, size_t size, bool write,
315 				unsigned long ret_ip);
316 
317 #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
318 
319 static __always_inline bool addr_has_metadata(const void *addr)
320 {
321 	return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
322 }
323 
324 #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
325 
326 const void *kasan_find_first_bad_addr(const void *addr, size_t size);
327 size_t kasan_get_alloc_size(void *object, struct kmem_cache *cache);
328 void kasan_complete_mode_report_info(struct kasan_report_info *info);
329 void kasan_metadata_fetch_row(char *buffer, void *row);
330 
331 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
332 void kasan_print_tags(u8 addr_tag, const void *addr);
333 #else
334 static inline void kasan_print_tags(u8 addr_tag, const void *addr) { }
335 #endif
336 
337 #if defined(CONFIG_KASAN_STACK)
338 void kasan_print_address_stack_frame(const void *addr);
339 #else
340 static inline void kasan_print_address_stack_frame(const void *addr) { }
341 #endif
342 
343 #ifdef CONFIG_KASAN_GENERIC
344 void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object);
345 #else
346 static inline void kasan_print_aux_stacks(struct kmem_cache *cache, const void *object) { }
347 #endif
348 
349 bool kasan_report(const void *addr, size_t size,
350 		bool is_write, unsigned long ip);
351 void kasan_report_invalid_free(void *object, unsigned long ip, enum kasan_report_type type);
352 
353 struct slab *kasan_addr_to_slab(const void *addr);
354 
355 #ifdef CONFIG_KASAN_GENERIC
356 void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size);
357 void kasan_init_object_meta(struct kmem_cache *cache, const void *object);
358 struct kasan_alloc_meta *kasan_get_alloc_meta(struct kmem_cache *cache,
359 						const void *object);
360 struct kasan_free_meta *kasan_get_free_meta(struct kmem_cache *cache,
361 						const void *object);
362 #else
363 static inline void kasan_init_cache_meta(struct kmem_cache *cache, unsigned int *size) { }
364 static inline void kasan_init_object_meta(struct kmem_cache *cache, const void *object) { }
365 #endif
366 
367 depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc);
368 void kasan_set_track(struct kasan_track *track, gfp_t flags);
369 void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags);
370 void kasan_save_free_info(struct kmem_cache *cache, void *object);
371 
372 #if defined(CONFIG_KASAN_GENERIC) && \
373 	(defined(CONFIG_SLAB) || defined(CONFIG_SLUB))
374 bool kasan_quarantine_put(struct kmem_cache *cache, void *object);
375 void kasan_quarantine_reduce(void);
376 void kasan_quarantine_remove_cache(struct kmem_cache *cache);
377 #else
378 static inline bool kasan_quarantine_put(struct kmem_cache *cache, void *object) { return false; }
379 static inline void kasan_quarantine_reduce(void) { }
380 static inline void kasan_quarantine_remove_cache(struct kmem_cache *cache) { }
381 #endif
382 
383 #ifndef arch_kasan_set_tag
384 static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
385 {
386 	return addr;
387 }
388 #endif
389 #ifndef arch_kasan_get_tag
390 #define arch_kasan_get_tag(addr)	0
391 #endif
392 
393 #define set_tag(addr, tag)	((void *)arch_kasan_set_tag((addr), (tag)))
394 #define get_tag(addr)		arch_kasan_get_tag(addr)
395 
396 #ifdef CONFIG_KASAN_HW_TAGS
397 
398 #define hw_enable_tag_checks_sync()		arch_enable_tag_checks_sync()
399 #define hw_enable_tag_checks_async()		arch_enable_tag_checks_async()
400 #define hw_enable_tag_checks_asymm()		arch_enable_tag_checks_asymm()
401 #define hw_suppress_tag_checks_start()		arch_suppress_tag_checks_start()
402 #define hw_suppress_tag_checks_stop()		arch_suppress_tag_checks_stop()
403 #define hw_force_async_tag_fault()		arch_force_async_tag_fault()
404 #define hw_get_random_tag()			arch_get_random_tag()
405 #define hw_get_mem_tag(addr)			arch_get_mem_tag(addr)
406 #define hw_set_mem_tag_range(addr, size, tag, init) \
407 			arch_set_mem_tag_range((addr), (size), (tag), (init))
408 
409 void kasan_enable_hw_tags(void);
410 
411 #else /* CONFIG_KASAN_HW_TAGS */
412 
413 static inline void kasan_enable_hw_tags(void) { }
414 
415 #endif /* CONFIG_KASAN_HW_TAGS */
416 
417 #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
418 void __init kasan_init_tags(void);
419 #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
420 
421 #if defined(CONFIG_KASAN_HW_TAGS) && IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
422 
423 void kasan_force_async_fault(void);
424 
425 #else /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
426 
427 static inline void kasan_force_async_fault(void) { }
428 
429 #endif /* CONFIG_KASAN_HW_TAGS && CONFIG_KASAN_KUNIT_TEST */
430 
431 #ifdef CONFIG_KASAN_SW_TAGS
432 u8 kasan_random_tag(void);
433 #elif defined(CONFIG_KASAN_HW_TAGS)
434 static inline u8 kasan_random_tag(void) { return hw_get_random_tag(); }
435 #else
436 static inline u8 kasan_random_tag(void) { return 0; }
437 #endif
438 
439 #ifdef CONFIG_KASAN_HW_TAGS
440 
441 static inline void kasan_poison(const void *addr, size_t size, u8 value, bool init)
442 {
443 	addr = kasan_reset_tag(addr);
444 
445 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
446 	if (is_kfence_address(addr))
447 		return;
448 
449 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
450 		return;
451 	if (WARN_ON(size & KASAN_GRANULE_MASK))
452 		return;
453 
454 	hw_set_mem_tag_range((void *)addr, size, value, init);
455 }
456 
457 static inline void kasan_unpoison(const void *addr, size_t size, bool init)
458 {
459 	u8 tag = get_tag(addr);
460 
461 	addr = kasan_reset_tag(addr);
462 
463 	/* Skip KFENCE memory if called explicitly outside of sl*b. */
464 	if (is_kfence_address(addr))
465 		return;
466 
467 	if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
468 		return;
469 	size = round_up(size, KASAN_GRANULE_SIZE);
470 
471 	hw_set_mem_tag_range((void *)addr, size, tag, init);
472 }
473 
474 static inline bool kasan_byte_accessible(const void *addr)
475 {
476 	u8 ptr_tag = get_tag(addr);
477 	u8 mem_tag = hw_get_mem_tag((void *)addr);
478 
479 	return ptr_tag == KASAN_TAG_KERNEL || ptr_tag == mem_tag;
480 }
481 
482 #else /* CONFIG_KASAN_HW_TAGS */
483 
484 /**
485  * kasan_poison - mark the memory range as inaccessible
486  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
487  * @size - range size, must be aligned to KASAN_GRANULE_SIZE
488  * @value - value that's written to metadata for the range
489  * @init - whether to initialize the memory range (only for hardware tag-based)
490  *
491  * The size gets aligned to KASAN_GRANULE_SIZE before marking the range.
492  */
493 void kasan_poison(const void *addr, size_t size, u8 value, bool init);
494 
495 /**
496  * kasan_unpoison - mark the memory range as accessible
497  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
498  * @size - range size, can be unaligned
499  * @init - whether to initialize the memory range (only for hardware tag-based)
500  *
501  * For the tag-based modes, the @size gets aligned to KASAN_GRANULE_SIZE before
502  * marking the range.
503  * For the generic mode, the last granule of the memory range gets partially
504  * unpoisoned based on the @size.
505  */
506 void kasan_unpoison(const void *addr, size_t size, bool init);
507 
508 bool kasan_byte_accessible(const void *addr);
509 
510 #endif /* CONFIG_KASAN_HW_TAGS */
511 
512 #ifdef CONFIG_KASAN_GENERIC
513 
514 /**
515  * kasan_poison_last_granule - mark the last granule of the memory range as
516  * inaccessible
517  * @addr - range start address, must be aligned to KASAN_GRANULE_SIZE
518  * @size - range size
519  *
520  * This function is only available for the generic mode, as it's the only mode
521  * that has partially poisoned memory granules.
522  */
523 void kasan_poison_last_granule(const void *address, size_t size);
524 
525 #else /* CONFIG_KASAN_GENERIC */
526 
527 static inline void kasan_poison_last_granule(const void *address, size_t size) { }
528 
529 #endif /* CONFIG_KASAN_GENERIC */
530 
531 #ifndef kasan_arch_is_ready
532 static inline bool kasan_arch_is_ready(void)	{ return true; }
533 #elif !defined(CONFIG_KASAN_GENERIC) || !defined(CONFIG_KASAN_OUTLINE)
534 #error kasan_arch_is_ready only works in KASAN generic outline mode!
535 #endif
536 
537 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST)
538 
539 void kasan_kunit_test_suite_start(void);
540 void kasan_kunit_test_suite_end(void);
541 
542 #else /* CONFIG_KASAN_KUNIT_TEST */
543 
544 static inline void kasan_kunit_test_suite_start(void) { }
545 static inline void kasan_kunit_test_suite_end(void) { }
546 
547 #endif /* CONFIG_KASAN_KUNIT_TEST */
548 
549 #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) || IS_ENABLED(CONFIG_KASAN_MODULE_TEST)
550 
551 bool kasan_save_enable_multi_shot(void);
552 void kasan_restore_multi_shot(bool enabled);
553 
554 #endif
555 
556 /*
557  * Exported functions for interfaces called from assembly or from generated
558  * code. Declared here to avoid warnings about missing declarations.
559  */
560 
561 asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
562 void __asan_register_globals(void *globals, ssize_t size);
563 void __asan_unregister_globals(void *globals, ssize_t size);
564 void __asan_handle_no_return(void);
565 void __asan_alloca_poison(void *, ssize_t size);
566 void __asan_allocas_unpoison(void *stack_top, ssize_t stack_bottom);
567 
568 void __asan_load1(void *);
569 void __asan_store1(void *);
570 void __asan_load2(void *);
571 void __asan_store2(void *);
572 void __asan_load4(void *);
573 void __asan_store4(void *);
574 void __asan_load8(void *);
575 void __asan_store8(void *);
576 void __asan_load16(void *);
577 void __asan_store16(void *);
578 void __asan_loadN(void *, ssize_t size);
579 void __asan_storeN(void *, ssize_t size);
580 
581 void __asan_load1_noabort(void *);
582 void __asan_store1_noabort(void *);
583 void __asan_load2_noabort(void *);
584 void __asan_store2_noabort(void *);
585 void __asan_load4_noabort(void *);
586 void __asan_store4_noabort(void *);
587 void __asan_load8_noabort(void *);
588 void __asan_store8_noabort(void *);
589 void __asan_load16_noabort(void *);
590 void __asan_store16_noabort(void *);
591 void __asan_loadN_noabort(void *, ssize_t size);
592 void __asan_storeN_noabort(void *, ssize_t size);
593 
594 void __asan_report_load1_noabort(void *);
595 void __asan_report_store1_noabort(void *);
596 void __asan_report_load2_noabort(void *);
597 void __asan_report_store2_noabort(void *);
598 void __asan_report_load4_noabort(void *);
599 void __asan_report_store4_noabort(void *);
600 void __asan_report_load8_noabort(void *);
601 void __asan_report_store8_noabort(void *);
602 void __asan_report_load16_noabort(void *);
603 void __asan_report_store16_noabort(void *);
604 void __asan_report_load_n_noabort(void *, ssize_t size);
605 void __asan_report_store_n_noabort(void *, ssize_t size);
606 
607 void __asan_set_shadow_00(const void *addr, ssize_t size);
608 void __asan_set_shadow_f1(const void *addr, ssize_t size);
609 void __asan_set_shadow_f2(const void *addr, ssize_t size);
610 void __asan_set_shadow_f3(const void *addr, ssize_t size);
611 void __asan_set_shadow_f5(const void *addr, ssize_t size);
612 void __asan_set_shadow_f8(const void *addr, ssize_t size);
613 
614 void *__asan_memset(void *addr, int c, ssize_t len);
615 void *__asan_memmove(void *dest, const void *src, ssize_t len);
616 void *__asan_memcpy(void *dest, const void *src, ssize_t len);
617 
618 void __hwasan_load1_noabort(void *);
619 void __hwasan_store1_noabort(void *);
620 void __hwasan_load2_noabort(void *);
621 void __hwasan_store2_noabort(void *);
622 void __hwasan_load4_noabort(void *);
623 void __hwasan_store4_noabort(void *);
624 void __hwasan_load8_noabort(void *);
625 void __hwasan_store8_noabort(void *);
626 void __hwasan_load16_noabort(void *);
627 void __hwasan_store16_noabort(void *);
628 void __hwasan_loadN_noabort(void *, ssize_t size);
629 void __hwasan_storeN_noabort(void *, ssize_t size);
630 
631 void __hwasan_tag_memory(void *, u8 tag, ssize_t size);
632 
633 void *__hwasan_memset(void *addr, int c, ssize_t len);
634 void *__hwasan_memmove(void *dest, const void *src, ssize_t len);
635 void *__hwasan_memcpy(void *dest, const void *src, ssize_t len);
636 
637 void kasan_tag_mismatch(void *addr, unsigned long access_info,
638 			unsigned long ret_ip);
639 
640 #endif /* __MM_KASAN_KASAN_H */
641