[PATCH 2/5] riscv: kexec_file: Pair PC-relative low parts with their high parts

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Oct 23 00:45:06 PDT 2026


> From: Han Gao <gaohan at iscas.ac.cn>
> 
> The purgatory relocation code applies R_RISCV_PCREL_HI20 to the auipc
> and to the instruction after it, and ignores R_RISCV_PCREL_LO12_I. This
> assumes that the low part immediately follows its high part. Compilers
> may schedule several auipc instructions before their users; clang does
> so in sha256_init(), which corrupts the hash and leaves purgatory
> spinning on a digest mismatch.
> 
> Apply the high part to the auipc only. Resolve each R_RISCV_PCREL_LO12_I
> and R_RISCV_PCREL_LO12_S through the R_RISCV_PCREL_HI20 at the address
> its symbol labels, as the module loader does.
> 
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Han Gao <gaohan at iscas.ac.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261023-riscv-kexec-cma-fixes-v1-0-825b90ea23c4@iscas.ac.cn?part=2




More information about the kexec mailing list