Re: [PATCH v1 0/4] LoongArch: BPF: Support instructions array, indirect jumps and calls

From: Tiezhu Yang

Date: Fri Dec 04 2026 - 02:11:20 EST


On 12/4/26 2:56 PM, George Guo wrote:
On 2026/11/23 12:39, Tiezhu Yang wrote:
Tested with the series of BPF selftests, here are the test results:

$ sudo ./test_progs -t bpf_insn_array | tail -1
Summary: 1/20 PASSED, 0 SKIPPED, 0/0 FAILED

$ sudo ./test_progs-cpuv4 -t gotox | tail -1
Summary: 2/14 PASSED, 0 SKIPPED, 0/0 FAILED

$ sudo ./test_progs -t callx | tail -1
Summary: 6/89 PASSED, 6 SKIPPED, 0/0 FAILED

Tested the whole series on Loongson-3C6000. These tests are skipped on
LoongArch upstream, so I added LoongArch to the arch checks in
bpf_insn_array.c, callx_func_ptr_map.c, callx_rodata_lskel.c,
verifier_callx.c, verifier_callx_rodata.c and verifier_gotox.c locally:

Thanks for your testing.
Here is the related BPF selftests patch series, which needs to send v2
once jit patches are in bpf-next tree, maybe after the next rc1, but
can be used to test:

[PATCH bpf-next v1 0/3] selftests/bpf: Enable instructions array, indirect calls tests for LoongArch
https://lore.kernel.org/loongarch/20261123045008.23691-1-yangtiezhu@xxxxxxxxxxx/T/#u

$ sudo ./test_progs -t bpf_insn_array | tail -1
Summary: 1/20 PASSED, 0 SKIPPED, 0/0 FAILED

$ sudo ./test_progs-cpuv4 -t gotox | tail -1
Summary: 2/47 PASSED, 0 SKIPPED, 0/0 FAILED

$ sudo ./test_progs -t jit_insns,jit_insns_blinded | tail -1
Summary: 2/47 PASSED, 0 SKIPPED, 0/0 FAILED

With CONFIG_ARCH_STRICT_ALIGN=n:

$ sudo ./test_progs -t callx | tail -1
Summary: 4/77 PASSED, 0 SKIPPED, 0/0 FAILED

With CONFIG_ARCH_STRICT_ALIGN=y:

$ sudo ./test_progs -t callx | tail -1
Summary: 3/76 PASSED, 0 SKIPPED, 1/1 FAILED

The only failure with CONFIG_ARCH_STRICT_ALIGN=y is
verifier_callx_rodata/callx_rodata_misaligned_read, and it is not
related to this series. HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
then, so the verifier checks alignment strictly. The program is still
rejected as expected, but by the alignment check first:

Here is a related fix patch:

selftests/bpf: Allow unaligned access in callx_rodata_misaligned_read
https://lore.kernel.org/loongarch/20261123045008.23691-3-yangtiezhu@xxxxxxxxxxx/

Thanks,
Tiezhu