[PATCH bpf-next v3 4/4] selftests/bpf: Allow unaligned access in jit_insns/tail_call

From: Tiezhu Yang

Date: Sun Nov 15 2026 - 22:59:36 EST


On architectures that may lack CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
such as RISC-V and LoongArch, the verifier rejects test_tail_call due
to a misaligned 8-byte load (BPF_DW) from the packet pointer, which is
triggered by the architecture-specific NET_IP_ALIGN offset variation.

As this test focuses on tail call rather than alignment enforcement,
set `.prog_flags = BPF_F_ANY_ALIGNMENT` in `bpf_prog_load_opts` to
bypass strict alignment checks on architectures lacking efficient
unaligned access.

Before:
$ sudo ./test_progs -a "jit_insns/tail_call"
...
6: (79) r3 = *(u64 *)(r2 +0)
misaligned packet access off 2+0+0 size 8
...
Summary: 0/0 PASSED, 0 SKIPPED, 1/1 FAILED

After:
$ sudo ./test_progs -a "jit_insns/tail_call"
...
Summary: 1/1 PASSED, 0 SKIPPED, 0/0 FAILED

Fixes: a9fee553d3db ("selftests/bpf: Extend the JIT instruction tests for arm64 encodings")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/jit_insns.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/jit_insns.c b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
index 4110b1ff6ff8..bdde6caa871e 100644
--- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
+++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
@@ -3620,6 +3620,7 @@ static void test_tail_call(void)
{ (~0ULL << 32) | 2, TAIL_FALL }, { ~0ULL, TAIL_FALL },
};
LIBBPF_OPTS(bpf_prog_load_opts, lopts,
+ .prog_flags = BPF_F_ANY_ALIGNMENT,
.log_buf = log,
.log_size = sizeof(log),
);
--
2.42.0