~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/include/asm/kasan.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __ASM_KASAN_H
  3 #define __ASM_KASAN_H
  4 
  5 #if defined(CONFIG_KASAN) && !defined(CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX)
  6 #define _GLOBAL_KASAN(fn)       _GLOBAL(__##fn)
  7 #define _GLOBAL_TOC_KASAN(fn)   _GLOBAL_TOC(__##fn)
  8 #define EXPORT_SYMBOL_KASAN(fn) EXPORT_SYMBOL(__##fn)
  9 #else
 10 #define _GLOBAL_KASAN(fn)       _GLOBAL(fn)
 11 #define _GLOBAL_TOC_KASAN(fn)   _GLOBAL_TOC(fn)
 12 #define EXPORT_SYMBOL_KASAN(fn)
 13 #endif
 14 
 15 #ifndef __ASSEMBLY__
 16 
 17 #include <asm/page.h>
 18 #include <linux/sizes.h>
 19 
 20 #define KASAN_SHADOW_SCALE_SHIFT        3
 21 
 22 #if defined(CONFIG_EXECMEM) && defined(CONFIG_PPC32)
 23 #define KASAN_KERN_START        ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M)
 24 #else
 25 #define KASAN_KERN_START        PAGE_OFFSET
 26 #endif
 27 
 28 #define KASAN_SHADOW_START      (KASAN_SHADOW_OFFSET + \
 29                                  (KASAN_KERN_START >> KASAN_SHADOW_SCALE_SHIFT))
 30 
 31 #define KASAN_SHADOW_OFFSET     ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
 32 
 33 #ifdef CONFIG_PPC32
 34 #define KASAN_SHADOW_END        (-(-KASAN_SHADOW_START >> KASAN_SHADOW_SCALE_SHIFT))
 35 #elif defined(CONFIG_PPC_BOOK3S_64)
 36 /*
 37  * The shadow ends before the highest accessible address
 38  * because we don't need a shadow for the shadow. Instead:
 39  * c00e000000000000 << 3 + a80e000000000000 = c00fc00000000000
 40  */
 41 #define KASAN_SHADOW_END 0xc00fc00000000000UL
 42 
 43 #else
 44 
 45 /*
 46  * The shadow ends before the highest accessible address
 47  * because we don't need a shadow for the shadow.
 48  * But it doesn't hurt to have a shadow for the shadow,
 49  * keep shadow end aligned eases things.
 50  */
 51 #define KASAN_SHADOW_END 0xc000200000000000UL
 52 
 53 #endif
 54 
 55 #ifdef CONFIG_KASAN
 56 #ifdef CONFIG_PPC_BOOK3S_64
 57 DECLARE_STATIC_KEY_FALSE(powerpc_kasan_enabled_key);
 58 
 59 static __always_inline bool kasan_arch_is_ready(void)
 60 {
 61         if (static_branch_likely(&powerpc_kasan_enabled_key))
 62                 return true;
 63         return false;
 64 }
 65 
 66 #define kasan_arch_is_ready kasan_arch_is_ready
 67 #endif
 68 
 69 void kasan_early_init(void);
 70 void kasan_mmu_init(void);
 71 void kasan_init(void);
 72 void kasan_late_init(void);
 73 #else
 74 static inline void kasan_init(void) { }
 75 static inline void kasan_mmu_init(void) { }
 76 static inline void kasan_late_init(void) { }
 77 #endif
 78 
 79 void kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte);
 80 int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end);
 81 int kasan_init_region(void *start, size_t size);
 82 
 83 #endif /* __ASSEMBLY */
 84 #endif
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php