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