aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/cpu-reset.h
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2021-04-08 11:28:38 -0700
committerKees Cook <keescook@chromium.org>2021-04-08 16:04:22 -0700
commitbde33977bf24b7ed52e2bac0eb9235769a0a11f6 (patch)
treefa53a587fbbbbf9f84625b72a41b9c7a43e76a50 /arch/arm64/kernel/cpu-reset.h
parentarm64: implement function_nocfi (diff)
downloadlinux-dev-bde33977bf24b7ed52e2bac0eb9235769a0a11f6.tar.xz
linux-dev-bde33977bf24b7ed52e2bac0eb9235769a0a11f6.zip
arm64: use function_nocfi with __pa_symbol
With CONFIG_CFI_CLANG, the compiler replaces function address references with the address of the function's CFI jump table entry. This means that __pa_symbol(function) returns the physical address of the jump table entry, which can lead to address space confusion as the jump table points to the function's virtual address. Therefore, use the function_nocfi() macro to ensure we are always taking the address of the actual function instead. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210408182843.1754385-14-samitolvanen@google.com
Diffstat (limited to 'arch/arm64/kernel/cpu-reset.h')
-rw-r--r--arch/arm64/kernel/cpu-reset.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/cpu-reset.h b/arch/arm64/kernel/cpu-reset.h
index ed50e9587ad8..f3adc574f969 100644
--- a/arch/arm64/kernel/cpu-reset.h
+++ b/arch/arm64/kernel/cpu-reset.h
@@ -22,7 +22,7 @@ static inline void __noreturn cpu_soft_restart(unsigned long entry,
unsigned long el2_switch = !is_kernel_in_hyp_mode() &&
is_hyp_mode_available();
- restart = (void *)__pa_symbol(__cpu_soft_restart);
+ restart = (void *)__pa_symbol(function_nocfi(__cpu_soft_restart));
cpu_install_idmap();
restart(el2_switch, entry, arg0, arg1, arg2);