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

TOMOYO Linux Cross Reference
Linux/arch/arm64/include/asm/asm_pointer_auth.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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_ASM_POINTER_AUTH_H
  3 #define __ASM_ASM_POINTER_AUTH_H
  4 
  5 #include <asm/alternative.h>
  6 #include <asm/asm-offsets.h>
  7 #include <asm/cpufeature.h>
  8 #include <asm/sysreg.h>
  9 
 10 #ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
 11 
 12         .macro __ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
 13         mov     \tmp1, #THREAD_KEYS_KERNEL
 14         add     \tmp1, \tsk, \tmp1
 15         ldp     \tmp2, \tmp3, [\tmp1, #PTRAUTH_KERNEL_KEY_APIA]
 16         msr_s   SYS_APIAKEYLO_EL1, \tmp2
 17         msr_s   SYS_APIAKEYHI_EL1, \tmp3
 18         .endm
 19 
 20         .macro ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
 21 alternative_if ARM64_HAS_ADDRESS_AUTH
 22         __ptrauth_keys_install_kernel_nosync \tsk, \tmp1, \tmp2, \tmp3
 23 alternative_else_nop_endif
 24         .endm
 25 
 26         .macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3
 27 alternative_if ARM64_HAS_ADDRESS_AUTH
 28         __ptrauth_keys_install_kernel_nosync \tsk, \tmp1, \tmp2, \tmp3
 29         isb
 30 alternative_else_nop_endif
 31         .endm
 32 
 33 #else /* CONFIG_ARM64_PTR_AUTH_KERNEL */
 34 
 35         .macro __ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
 36         .endm
 37 
 38         .macro ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
 39         .endm
 40 
 41         .macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3
 42         .endm
 43 
 44 #endif /* CONFIG_ARM64_PTR_AUTH_KERNEL */
 45 
 46 #ifdef CONFIG_ARM64_PTR_AUTH
 47 /*
 48  * thread.keys_user.ap* as offset exceeds the #imm offset range
 49  * so use the base value of ldp as thread.keys_user and offset as
 50  * thread.keys_user.ap*.
 51  */
 52         .macro __ptrauth_keys_install_user tsk, tmp1, tmp2, tmp3
 53         mov     \tmp1, #THREAD_KEYS_USER
 54         add     \tmp1, \tsk, \tmp1
 55         ldp     \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APIA]
 56         msr_s   SYS_APIAKEYLO_EL1, \tmp2
 57         msr_s   SYS_APIAKEYHI_EL1, \tmp3
 58         .endm
 59 
 60         .macro __ptrauth_keys_init_cpu tsk, tmp1, tmp2, tmp3
 61         mrs     \tmp1, id_aa64isar1_el1
 62         ubfx    \tmp1, \tmp1, #ID_AA64ISAR1_EL1_APA_SHIFT, #8
 63         mrs_s   \tmp2, SYS_ID_AA64ISAR2_EL1
 64         ubfx    \tmp2, \tmp2, #ID_AA64ISAR2_EL1_APA3_SHIFT, #4
 65         orr     \tmp1, \tmp1, \tmp2
 66         cbz     \tmp1, .Lno_addr_auth\@
 67         mov_q   \tmp1, (SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | \
 68                         SCTLR_ELx_ENDA | SCTLR_ELx_ENDB)
 69         mrs     \tmp2, sctlr_el1
 70         orr     \tmp2, \tmp2, \tmp1
 71         msr     sctlr_el1, \tmp2
 72         __ptrauth_keys_install_kernel_nosync \tsk, \tmp1, \tmp2, \tmp3
 73         isb
 74 .Lno_addr_auth\@:
 75         .endm
 76 
 77         .macro ptrauth_keys_init_cpu tsk, tmp1, tmp2, tmp3
 78 alternative_if_not ARM64_HAS_ADDRESS_AUTH
 79         b       .Lno_addr_auth\@
 80 alternative_else_nop_endif
 81         __ptrauth_keys_init_cpu \tsk, \tmp1, \tmp2, \tmp3
 82 .Lno_addr_auth\@:
 83         .endm
 84 
 85 #else /* !CONFIG_ARM64_PTR_AUTH */
 86 
 87         .macro ptrauth_keys_install_user tsk, tmp1, tmp2, tmp3
 88         .endm
 89 
 90 #endif /* CONFIG_ARM64_PTR_AUTH */
 91 
 92 #endif /* __ASM_ASM_POINTER_AUTH_H */
 93 

~ [ 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