[PATCH] riscv: fix KUnit test_kprobes crash when building with Clang
Jiakai Xu
xujiakai2025 at iscas.ac.cn
Tue Nov 18 19:33:34 PST 2025
Hi Nathan,
> I spent some time today trying to minimize a small set of configurations
> that triggers this issue on top of defconfig since that occasionally
> reveals a path to head down for triage and I landed on:
> ...
Thank you for taking the time to minimize the configuration and
provide the detailed reproduction steps.
> This appears to happen back to LLVM 15 so I am not sure it is a recent
> recent regression on the toolchain side.
>
> Without CONFIG_RELOCATABLE enabled, the test passes:
>
> [ 1.049384] KTAP version 1
> [ 1.049656] 1..1
> [ 1.050246] KTAP version 1
> [ 1.050447] # Subtest: kprobes_riscv
> [ 1.050760] # module: kprobes_riscv_kunit
> [ 1.050867] 1..1
> [ 1.061790] ok 1 test_kprobe_riscv
> [ 1.061929] ok 1 kprobes_riscv
>
> Interestingly, if I enable CONFIG_RISCV_KPROBES_KUNIT as a module, I get
> a failure when trying to load it in QEMU:
>
> ~ # modprobe kprobes_riscv_kunit
> [ 42.214642] kprobes_riscv_kunit: The unexpected relocation type 'R_RISCV_ALIGN' from PC = 00000000abb84ce7
> [ 42.222778] kprobes_riscv_kunit: The unexpected relocation type 'R_RISCV_ALIGN' from PC = 00000000abb84ce7
> modprobe: can't load module kprobes_riscv_kunit (kernel/arch/riscv/kernel/tests/kprobes/kprobes_riscv_kunit.ko): Invalid argument
This information is very useful for upstream triage and
confirms that the issue is configuration-dependent.
> which is probably unrelated but I figured it was worth mentioning, as it
> does not allow me to see if this has something to do with the flags
> added to LDFLAGS_vmlinux.
>
> Maybe this is useful for the upstream report and further triage.
I really appreciate your effort in providing this data;
it will definitely help with further analysis and reporting.
thanks,
- Jiakai
More information about the linux-riscv
mailing list