Commit Graph
3 Commits
Author SHA1 Message Date
Amit Daniel Kachhap e51f5f56dd arm64: suspend: restore the kernel ptrauth keys
This patch restores the kernel keys from current task during cpu resume
after the mmu is turned on and ptrauth is enabled.

A flag is added in macro ptrauth_keys_install_kernel to check if isb
instruction needs to be executed.

Signed-off-by: Amit Daniel Kachhap <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
2020-03-18 09:50:21 +00:00
Kristina Martsenko 33e4523498 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]>
2020-03-18 09:50:20 +00:00
Kristina Martsenko be12984256 arm64: install user ptrauth keys at kernel exit time
As we're going to enable pointer auth within the kernel and use a
different APIAKey for the kernel itself, so move the user APIAKey
switch to EL0 exception return.

The other 4 keys could remain switched during task switch, but are also
moved to keep things consistent.

Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: James Morse <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
Signed-off-by: Kristina Martsenko <[email protected]>
[Amit: commit msg, re-positioned the patch, comments]
Signed-off-by: Amit Daniel Kachhap <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
2020-03-18 09:50:19 +00:00