diff options
author | Menglong Dong <[email protected]> | 2023-12-19 21:48:00 +0800 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2023-12-19 17:18:56 -0800 |
commit | 463ea64eb008b7abb63245ed69446b404bf042b1 (patch) | |
tree | 0d1fa15dd3ee74bc0af37143406f7d19e8a3dddc /kernel/bpf/memalloc.c | |
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 <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'kernel/bpf/memalloc.c')
0 files changed, 0 insertions, 0 deletions