arm64: Always load shadow stack pointer directly from the task struct
authorArd Biesheuvel <ardb@kernel.org>
Mon, 9 Jan 2023 17:47:59 +0000 (18:47 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 20 Jan 2023 14:26:18 +0000 (14:26 +0000)
commit2198d07c509f1db4a1185d1f65aaada794c6ea59
tree959c8deb4f69da3440f51b57bd907b4af036f602
parentb7bfaa761d760e72a969d116517eaa12e404c262
arm64: Always load shadow stack pointer directly from the task struct

All occurrences of the scs_load macro load the value of the shadow call
stack pointer from the task which is current at that point. So instead
of taking a task struct register argument in the scs_load macro to
specify the task struct to load from, let's always reference the current
task directly. This should make it much harder to exploit any
instruction sequences reloading the shadow call stack pointer register
from memory.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230109174800.3286265-2-ardb@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/scs.h
arch/arm64/kernel/entry.S
arch/arm64/kernel/head.S