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