arm64: use function_nocfi with __pa_symbol
authorSami Tolvanen <samitolvanen@google.com>
Thu, 8 Apr 2021 18:28:38 +0000 (11:28 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 8 Apr 2021 23:04:22 +0000 (16:04 -0700)
commitbde33977bf24b7ed52e2bac0eb9235769a0a11f6
treefa53a587fbbbbf9f84625b72a41b9c7a43e76a50
parent4ecfca89893843d4ae266485bb878aa760ba82da
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
arch/arm64/include/asm/mmu_context.h
arch/arm64/kernel/acpi_parking_protocol.c
arch/arm64/kernel/cpu-reset.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/psci.c
arch/arm64/kernel/smp_spin_table.c