bpf, tests: Add tests for BPF_LDX/BPF_STX with different offsets
authorXu Kuohai <xukuohai@huawei.com>
Mon, 21 Mar 2022 15:28:51 +0000 (11:28 -0400)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 31 Mar 2022 22:27:48 +0000 (00:27 +0200)
commitf516420f683d147d8f4cfd83bbc7c3c6ad1c61b5
tree386121ba68e9330c55b61efc84d6fd385a2c468a
parent5b3d19b9bd4080d7f5e260f91ce8f639e19eb499
bpf, tests: Add tests for BPF_LDX/BPF_STX with different offsets

This patch adds tests to verify the behavior of BPF_LDX/BPF_STX +
BPF_B/BPF_H/BPF_W/BPF_DW with negative offset, small positive offset,
large positive offset, and misaligned offset.

Tested on both big-endian and little-endian arm64 qemu, result:

 test_bpf: Summary: 1026 PASSED, 0 FAILED, [1014/1014 JIT'ed]']
 test_bpf: test_tail_calls: Summary: 8 PASSED, 0 FAILED, [8/8 JIT'ed]
 test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED

Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220321152852.2334294-5-xukuohai@huawei.com
lib/test_bpf.c