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