Re: [PATCH] riscv: fix KUnit test_kprobes crash when building with Clang
From: Paul Walmsley
Date: Sun Nov 16 2025 - 00:15:23 EST
+ Nam Cao, Nathan Chancellor
On Thu, 13 Nov 2025, 许佳凯 wrote:
> Clang misaligns the test_kprobes_addresses and test_kprobes_functions
> arrays, or does not export local labels by default. Both can cause
> kmalloc_array() allocation errors and KUnit failures.
>
> This patch fixes the issue by:
> - Adding .section .rodata to explicitly place arrays in the read-only data segment.
> - Adding .align 3 to align arrays to 8 bytes.
> - Adding .globl to probe labels to ensure symbols are visible.
>
> For detailed debug and analysis, see:
> https://github.com/j1akai/temp/blob/main/20251113/readme.md
>
> Signed-off-by: Jiakai Xu <xujiakai2025@xxxxxxxxxxx>
Hello Jiakai Xu,
Thanks for the patch. Have you reported this difference in behavior to
the Clang/LLVM folks so they can render an opinion on it? We can consider
this as a short term workaround if it's indeed a toolchain issue, but I'd
like to hear from the LLVM folks.
Also: could you please include the narrative from your page
https://github.com/j1akai/temp/blob/main/20251113/readme.md
in the patch description, just in case that URL eventually becomes
unavailable?
thanks,
- Paul