123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- #ifndef _LINUX_KMSAN_H
- #define _LINUX_KMSAN_H
- #include <linux/dma-direction.h>
- #include <linux/gfp.h>
- #include <linux/kmsan-checks.h>
- #include <linux/types.h>
- struct page;
- struct kmem_cache;
- struct task_struct;
- struct scatterlist;
- struct urb;
- #ifdef CONFIG_KMSAN
- void kmsan_task_create(struct task_struct *task);
- void kmsan_task_exit(struct task_struct *task);
- void __init kmsan_init_shadow(void);
- void __init kmsan_init_runtime(void);
- bool __init kmsan_memblock_free_pages(struct page *page, unsigned int order);
- void kmsan_alloc_page(struct page *page, unsigned int order, gfp_t flags);
- void kmsan_free_page(struct page *page, unsigned int order);
- void kmsan_copy_page_meta(struct page *dst, struct page *src);
- void kmsan_slab_alloc(struct kmem_cache *s, void *object, gfp_t flags);
- void kmsan_slab_free(struct kmem_cache *s, void *object);
- void kmsan_kmalloc_large(const void *ptr, size_t size, gfp_t flags);
- void kmsan_kfree_large(const void *ptr);
- int kmsan_vmap_pages_range_noflush(unsigned long start, unsigned long end,
- pgprot_t prot, struct page **pages,
- unsigned int page_shift);
- void kmsan_vunmap_range_noflush(unsigned long start, unsigned long end);
- int kmsan_ioremap_page_range(unsigned long addr, unsigned long end,
- phys_addr_t phys_addr, pgprot_t prot,
- unsigned int page_shift);
- void kmsan_iounmap_page_range(unsigned long start, unsigned long end);
- void kmsan_handle_dma(struct page *page, size_t offset, size_t size,
- enum dma_data_direction dir);
- void kmsan_handle_dma_sg(struct scatterlist *sg, int nents,
- enum dma_data_direction dir);
- void kmsan_handle_urb(const struct urb *urb, bool is_out);
- void kmsan_unpoison_entry_regs(const struct pt_regs *regs);
- #else
- static inline void kmsan_init_shadow(void)
- {
- }
- static inline void kmsan_init_runtime(void)
- {
- }
- static inline bool kmsan_memblock_free_pages(struct page *page,
- unsigned int order)
- {
- return true;
- }
- static inline void kmsan_task_create(struct task_struct *task)
- {
- }
- static inline void kmsan_task_exit(struct task_struct *task)
- {
- }
- static inline int kmsan_alloc_page(struct page *page, unsigned int order,
- gfp_t flags)
- {
- return 0;
- }
- static inline void kmsan_free_page(struct page *page, unsigned int order)
- {
- }
- static inline void kmsan_copy_page_meta(struct page *dst, struct page *src)
- {
- }
- static inline void kmsan_slab_alloc(struct kmem_cache *s, void *object,
- gfp_t flags)
- {
- }
- static inline void kmsan_slab_free(struct kmem_cache *s, void *object)
- {
- }
- static inline void kmsan_kmalloc_large(const void *ptr, size_t size,
- gfp_t flags)
- {
- }
- static inline void kmsan_kfree_large(const void *ptr)
- {
- }
- static inline int kmsan_vmap_pages_range_noflush(unsigned long start,
- unsigned long end,
- pgprot_t prot,
- struct page **pages,
- unsigned int page_shift)
- {
- return 0;
- }
- static inline void kmsan_vunmap_range_noflush(unsigned long start,
- unsigned long end)
- {
- }
- static inline int kmsan_ioremap_page_range(unsigned long start,
- unsigned long end,
- phys_addr_t phys_addr, pgprot_t prot,
- unsigned int page_shift)
- {
- return 0;
- }
- static inline void kmsan_iounmap_page_range(unsigned long start,
- unsigned long end)
- {
- }
- static inline void kmsan_handle_dma(struct page *page, size_t offset,
- size_t size, enum dma_data_direction dir)
- {
- }
- static inline void kmsan_handle_dma_sg(struct scatterlist *sg, int nents,
- enum dma_data_direction dir)
- {
- }
- static inline void kmsan_handle_urb(const struct urb *urb, bool is_out)
- {
- }
- static inline void kmsan_unpoison_entry_regs(const struct pt_regs *regs)
- {
- }
- #endif
- #endif
|