ANDROID: psci: use __pa_function for cpu_resume

With CONFIG_CFI_CLANG, the compiler replaces function pointers with
jump table addresses, which results in __pa_symbol returning the
physical address of the jump table entry. As the jump table contains
an immediate jump to an EL1 virtual address, this typically won't
work as intended. Use __pa_function instead to get the address to
cpu_resume.

Bug: 145210207
Change-Id: Iebcb0950b074c0ed0ddc6ec6cd8c4ff539f00e7c
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen
2021-02-04 14:29:02 -08:00
committed by Alistair Delva
parent 977c0ac09f
commit 8bb774b6f8

View File

@@ -334,7 +334,7 @@ static int psci_suspend_finisher(unsigned long state)
{
u32 power_state = state;
return psci_ops.cpu_suspend(power_state, __pa_symbol(cpu_resume));
return psci_ops.cpu_suspend(power_state, __pa_function(cpu_resume));
}
int psci_cpu_suspend_enter(u32 state)
@@ -353,7 +353,7 @@ int psci_cpu_suspend_enter(u32 state)
static int psci_system_suspend(unsigned long unused)
{
return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
__pa_symbol(cpu_resume), 0, 0);
__pa_function(cpu_resume), 0, 0);
}
static int psci_system_suspend_enter(suspend_state_t state)