diff options
| author | Kristina Martsenko <[email protected]> | 2020-03-13 09:04:56 +0000 |
|---|---|---|
| committer | Catalin Marinas <[email protected]> | 2020-03-18 09:50:20 +0000 |
| commit | 33e45234987ea3ed4b05fc512f4441696478f12d (patch) | |
| tree | e7dbf5120c409f20c20d7b095dca1244ec3f3b85 /arch/arm64/include/asm/asm_pointer_auth.h | |
| parent | arm64: enable ptrauth earlier (diff) | |
| download | kernel-33e45234987ea3ed4b05fc512f4441696478f12d.tar.gz kernel-33e45234987ea3ed4b05fc512f4441696478f12d.zip | |
arm64: initialize and switch ptrauth kernel keys
Set up keys to use pointer authentication within the kernel. The kernel
will be compiled with APIAKey instructions, the other keys are currently
unused. Each task is given its own APIAKey, which is initialized during
fork. The key is changed during context switch and on kernel entry from
EL0.
The keys for idle threads need to be set before calling any C functions,
because it is not possible to enter and exit a function with different
keys.
Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
Signed-off-by: Kristina Martsenko <[email protected]>
[Amit: Modified secondary cores key structure, comments]
Signed-off-by: Amit Daniel Kachhap <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
Diffstat (limited to 'arch/arm64/include/asm/asm_pointer_auth.h')
| -rw-r--r-- | arch/arm64/include/asm/asm_pointer_auth.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/asm_pointer_auth.h b/arch/arm64/include/asm/asm_pointer_auth.h index 3482348ec07f..d3f4aee42851 100644 --- a/arch/arm64/include/asm/asm_pointer_auth.h +++ b/arch/arm64/include/asm/asm_pointer_auth.h @@ -39,11 +39,25 @@ alternative_if ARM64_HAS_GENERIC_AUTH alternative_else_nop_endif .endm + .macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3 +alternative_if ARM64_HAS_ADDRESS_AUTH + mov \tmp1, #THREAD_KEYS_KERNEL + add \tmp1, \tsk, \tmp1 + ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_KERNEL_KEY_APIA] + msr_s SYS_APIAKEYLO_EL1, \tmp2 + msr_s SYS_APIAKEYHI_EL1, \tmp3 + isb +alternative_else_nop_endif + .endm + #else /* CONFIG_ARM64_PTR_AUTH */ .macro ptrauth_keys_install_user tsk, tmp1, tmp2, tmp3 .endm + .macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3 + .endm + #endif /* CONFIG_ARM64_PTR_AUTH */ #endif /* __ASM_ASM_POINTER_AUTH_H */ |
