diff options
author | Menglong Dong <menglong8.dong@gmail.com> | 2023-12-19 21:48:00 +0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-12-19 17:18:56 -0800 |
commit | 463ea64eb008b7abb63245ed69446b404bf042b1 (patch) | |
tree | 0d1fa15dd3ee74bc0af37143406f7d19e8a3dddc /tools/hv | |
parent | 31d9cc96b1e3b28daf74938cb1233231474bbcf6 (diff) |
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/hv')
0 files changed, 0 insertions, 0 deletions