ANDROID: arm64: kernel: use __pa_function for secondary_entry

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 of
secondary_entry.

Bug: 178005287
Change-Id: I90aea4cacd66ac224aae5c1a577decda1d922c22
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen
2021-02-04 14:28:43 -08:00
committed by Alistair Delva
parent a8313dbdb3
commit 977c0ac09f

View File

@@ -99,7 +99,7 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu)
* that read this address need to convert this address to the
* Boot-Loader's endianness before jumping.
*/
writeq_relaxed(__pa_symbol(secondary_entry), &mailbox->entry_point);
writeq_relaxed(__pa_function(secondary_entry), &mailbox->entry_point);
writel_relaxed(cpu_entry->gic_cpu_id, &mailbox->cpu_id);
arch_send_wakeup_ipi_mask(cpumask_of(cpu));