diff options
author | 2023-12-19 21:48:00 +0800 | |
---|---|---|
committer | 2023-12-19 17:18:56 -0800 | |
commit | 463ea64eb008b7abb63245ed69446b404bf042b1 (patch) | |
tree | 0d1fa15dd3ee74bc0af37143406f7d19e8a3dddc /tools/testing/selftests/bpf/progs/exceptions.c | |
parent | selftests/bpf: activate the OP_NE logic in range_cond() (diff) | |
download | wireguard-linux-463ea64eb008b7abb63245ed69446b404bf042b1.tar.xz wireguard-linux-463ea64eb008b7abb63245ed69446b404bf042b1.zip |
selftests/bpf: add testcase to verifier_bounds.c for BPF_JNE
Add testcase for the logic that the verifier tracks the BPF_JNE for regs.
The assembly function "reg_not_equal_const()" and "reg_equal_const" that
we add is exactly converted from the following case:
u32 a = bpf_get_prandom_u32();
u64 b = 0;
a %= 8;
/* the "a > 0" here will be optimized to "a != 0" */
if (a > 0) {
/* now the range of a should be [1, 7] */
bpf_skb_store_bytes(skb, 0, &b, a, 0);
}
Signed-off-by: Menglong Dong <menglong8.dong@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20231219134800.1550388-5-menglong8.dong@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/exceptions.c')
0 files changed, 0 insertions, 0 deletions