]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv/kexec_file: Handle R_RISCV_64 in purgatory relocator
authorYao Zi <ziyao@disroot.org>
Wed, 26 Mar 2025 05:14:46 +0000 (05:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:33 +0000 (14:39 +0200)
commit4c6b1d08e61460949021011353604a06ff515e85
tree8f715898b9920c926272ed6b564fd733c2bd40d3
parentbe85b932b57864599905021e1070adf4eb292860
riscv/kexec_file: Handle R_RISCV_64 in purgatory relocator

[ Upstream commit 28093cfef5dd62f4cbd537f2bdf6f0bf85309c45 ]

Commit 58ff537109ac ("riscv: Omit optimized string routines when
using KASAN") introduced calls to EXPORT_SYMBOL() in assembly string
routines, which result in R_RISCV_64 relocations against
.export_symbol section. As these rountines are reused by RISC-V
purgatory and our relocator doesn't recognize these relocations, this
fails kexec-file-load with dmesg like

[   11.344251] kexec_image: Unknown rela relocation: 2
[   11.345972] kexec_image: Error loading purgatory ret=-8

Let's support R_RISCV_64 relocation to fix kexec on 64-bit RISC-V.
32-bit variant isn't covered since KEXEC_FILE and KEXEC_PURGATORY isn't
available.

Fixes: 58ff537109ac ("riscv: Omit optimized string routines when using KASAN")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20250326051445.55131-2-ziyao@disroot.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/kernel/elf_kexec.c