Lines Matching +full:page +full:- +full:size

1 /* SPDX-License-Identifier: GPL-2.0 */
6 #include <linux/kasan-enabled.h>
7 #include <linux/kasan-tags.h>
13 struct page;
66 int kasan_add_zero_shadow(void *start, unsigned long size);
67 void kasan_remove_zero_shadow(void *start, unsigned long size);
77 static inline int kasan_add_zero_shadow(void *start, unsigned long size) in kasan_add_zero_shadow() argument
82 unsigned long size) in kasan_remove_zero_shadow() argument
102 void __kasan_unpoison_range(const void *addr, size_t size);
103 static __always_inline void kasan_unpoison_range(const void *addr, size_t size) in kasan_unpoison_range() argument
106 __kasan_unpoison_range(addr, size); in kasan_unpoison_range()
109 void __kasan_poison_pages(struct page *page, unsigned int order, bool init);
110 static __always_inline void kasan_poison_pages(struct page *page, in kasan_poison_pages() argument
114 __kasan_poison_pages(page, order, init); in kasan_poison_pages()
117 bool __kasan_unpoison_pages(struct page *page, unsigned int order, bool init);
118 static __always_inline bool kasan_unpoison_pages(struct page *page, in kasan_unpoison_pages() argument
122 return __kasan_unpoison_pages(page, order, init); in kasan_unpoison_pages()
135 * kasan_unpoison_new_object - Temporarily unpoison a new slab object.
153 * kasan_unpoison_new_object - Repoison a new slab object.
181 * kasan_slab_pre_free - Check whether freeing a slab object is safe.
185 * check for double-free and invalid-free bugs and report them.
202 * kasan_slab_free - Poison, initialize, and quarantine a slab object.
252 size_t size, gfp_t flags);
254 const void *object, size_t size, gfp_t flags) in kasan_kmalloc() argument
257 return __kasan_kmalloc(s, object, size, flags); in kasan_kmalloc()
262 size_t size, gfp_t flags);
264 size_t size, gfp_t flags) in kasan_kmalloc_large() argument
267 return __kasan_kmalloc_large(ptr, size, flags); in kasan_kmalloc_large()
281 bool __kasan_mempool_poison_pages(struct page *page, unsigned int order,
284 * kasan_mempool_poison_pages - Check and poison a mempool page allocation.
285 * @page: Pointer to the page allocation.
288 * This function is intended for kernel subsystems that cache page allocations
292 * page allocations.
299 static __always_inline bool kasan_mempool_poison_pages(struct page *page, in kasan_mempool_poison_pages() argument
303 return __kasan_mempool_poison_pages(page, order, _RET_IP_); in kasan_mempool_poison_pages()
307 void __kasan_mempool_unpoison_pages(struct page *page, unsigned int order,
310 * kasan_mempool_unpoison_pages - Unpoison a mempool page allocation.
311 * @page: Pointer to the page allocation.
314 * This function is intended for kernel subsystems that cache page allocations
317 * This function unpoisons a page allocation that was previously poisoned by
319 * the tag-based modes, this function assigns a new tag to the allocation.
321 static __always_inline void kasan_mempool_unpoison_pages(struct page *page, in kasan_mempool_unpoison_pages() argument
325 __kasan_mempool_unpoison_pages(page, order, _RET_IP_); in kasan_mempool_unpoison_pages()
330 * kasan_mempool_poison_object - Check and poison a mempool slab allocation.
341 * This function also performs checks to detect double-free and invalid-free
350 * size > KMALLOC_MAX_SIZE).
361 void __kasan_mempool_unpoison_object(void *ptr, size_t size, unsigned long ip);
363 * kasan_mempool_unpoison_object - Unpoison a mempool slab allocation.
365 * @size: Size to be unpoisoned.
373 * initializing the allocation's memory. For the tag-based modes, this function
379 * size > KMALLOC_MAX_SIZE).
382 size_t size) in kasan_mempool_unpoison_object() argument
385 __kasan_mempool_unpoison_object(ptr, size, _RET_IP_); in kasan_mempool_unpoison_object()
390 * the hardware tag-based mode that doesn't rely on compiler instrumentation.
402 static inline void kasan_unpoison_range(const void *address, size_t size) {} in kasan_unpoison_range() argument
403 static inline void kasan_poison_pages(struct page *page, unsigned int order, in kasan_poison_pages() argument
405 static inline bool kasan_unpoison_pages(struct page *page, unsigned int order, in kasan_unpoison_pages() argument
438 size_t size, gfp_t flags) in kasan_kmalloc() argument
442 static inline void *kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags) in kasan_kmalloc_large() argument
451 static inline bool kasan_mempool_poison_pages(struct page *page, unsigned int order) in kasan_mempool_poison_pages() argument
455 static inline void kasan_mempool_unpoison_pages(struct page *page, unsigned int order) {} in kasan_mempool_unpoison_pages() argument
460 static inline void kasan_mempool_unpoison_object(void *ptr, size_t size) {} in kasan_mempool_unpoison_object() argument
485 void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
495 /* Tag-based KASAN modes do not use per-object metadata. */
501 /* And no cache-related metadata initialization is required. */
503 unsigned int *size, in kasan_cache_create() argument
521 * kasan_report - print a report about a bad memory access detected by KASAN
523 * @size: size of the bad access
527 bool kasan_report(const void *addr, size_t size,
563 void kasan_populate_early_vm_area_shadow(void *start, unsigned long size);
564 int kasan_populate_vmalloc(unsigned long addr, unsigned long size);
572 unsigned long size) in kasan_populate_early_vm_area_shadow() argument
575 unsigned long size) in kasan_populate_vmalloc() argument
586 void *__kasan_unpoison_vmalloc(const void *start, unsigned long size,
589 unsigned long size, in kasan_unpoison_vmalloc() argument
593 return __kasan_unpoison_vmalloc(start, size, flags); in kasan_unpoison_vmalloc()
597 void __kasan_poison_vmalloc(const void *start, unsigned long size);
599 unsigned long size) in kasan_poison_vmalloc() argument
602 __kasan_poison_vmalloc(start, size); in kasan_poison_vmalloc()
608 unsigned long size) { } in kasan_populate_early_vm_area_shadow() argument
610 unsigned long size) in kasan_populate_vmalloc() argument
620 unsigned long size, in kasan_unpoison_vmalloc() argument
625 static inline void kasan_poison_vmalloc(const void *start, unsigned long size) in kasan_poison_vmalloc() argument
638 int kasan_alloc_module_shadow(void *addr, size_t size, gfp_t gfp_mask);
643 static inline int kasan_alloc_module_shadow(void *addr, size_t size, gfp_t gfp_mask) { return 0; } in kasan_alloc_module_shadow() argument