On architectures that may lack CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS (such as RISC-V and LoongArch), the verifier rejects unaligned 8-byte loads at offset +4 in callx_rodata_misaligned_read with a "misaligned value access" error before reaching the intended function pointer overlap check. As this test focuses on verifying function pointer overlap rejection rather than alignment enforcement, add `__flag(BPF_F_ANY_ALIGNMENT)` to the test case to bypass strict alignment checks on architectures lacking efficient unaligned access. Before: $ sudo ./test_progs -t verifier_callx_rodata/callx_rodata_misaligned_read ... 5: (79) r0 = *(u64 *)(r6 +4) misaligned value access off 352+4 size 8 ... Summary: 0/0 PASSED, 0 SKIPPED, 1/1 FAILED After: $ sudo ./test_progs -t verifier_callx_rodata/callx_rodata_misaligned_read ... Summary: 1/1 PASSED, 0 SKIPPED, 0/0 FAILED Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data") Signed-off-by: Tiezhu Yang --- tools/testing/selftests/bpf/progs/verifier_callx_rodata.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c index 0389df720db2..8034e736d03a 100644 --- a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c +++ b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c @@ -770,6 +770,7 @@ __naked void callx_rodata_partial_read(void) } SEC("socket") +__flag(BPF_F_ANY_ALIGNMENT) __failure __msg("read of 8 bytes at offset") __msg("overlaps with a pointer to a function") __naked void callx_rodata_misaligned_read(void) -- 2.42.0