linux/arch/powerpc/kexec
Christophe Leroy 7b40c5b938 powerpc/kexec: fix physical address calculation in clear_utlb_entry()
[ Upstream commit 861efb8a48 ]

In relocate_32.S, function clear_utlb_entry() goes into real mode. To
do so, it has to calculate the physical address based on the virtual
address. To get the virtual address it uses 'bl' which is problematic
(see commit c974809a26 ("powerpc/vdso: Avoid link stack corruption
in __get_datapage()")). In addition, the calculation is done on a
wrong address because 'bl' loads LR with the address of the following
instruction, not the address of the target. So when the target is not
the instruction following the 'bl' instruction, it may lead to
unexpected behaviour.

Fix it by re-writing the code so that is goes via another path which
is based 'bcl 20,31,.+4' which is the right instruction to use for that.

Fixes: 6834302003 ("powerpc/47x: Kernel support for KEXEC")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/dc4f9616fba9c05c5dbf9b4b5480eb1c362adc17.1741256651.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-04-10 14:39:16 +02:00
..
core.c powerpc/kdump: Split KEXEC_CORE and CRASH_DUMP dependency 2024-03-17 13:34:00 +11:00
core_32.c powerpc: Remove CONFIG_FSL_BOOKE 2022-09-26 22:47:37 +10:00
core_64.c powerpc updates for 6.11 2024-07-19 21:00:33 -07:00
crash.c powerpc/crash: remove unnecessary NULL check before kvfree() 2024-05-03 12:20:50 +10:00
elf_64.c powerpc/kexec_file: fix extra size calculation for kexec FDT 2024-06-17 22:48:45 +10:00
file_load.c powerpc: Delete unused function delete_fdt_mem_rsv() 2021-03-08 12:06:30 -07:00
file_load_64.c powerpc/kexec: Fix return of uninitialized variable 2024-12-05 14:02:14 +01:00
Makefile powerpc/kexec: move *_memory_ranges functions to ranges.c 2024-04-23 14:59:01 +10:00
ranges.c powerpc/crash: add crash memory hotplug support 2024-04-23 15:00:04 +10:00
relocate_32.S powerpc/kexec: fix physical address calculation in clear_utlb_entry() 2025-04-10 14:39:16 +02:00
vmcore_info.c arch, crash: move arch_crash_save_vmcoreinfo() out to file vmcore_info.c 2024-02-23 17:48:25 -08:00