aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kselftest.h
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@orange.com>2019-04-24 21:51:26 +0200
committerAlexei Starovoitov <ast@kernel.org>2019-04-25 17:20:06 -0700
commit6dd7f14080473b655c247863e61b7c34424f0c83 (patch)
tree4ab4ef6b132c7066ef4f4df74211707caf0b324b /tools/testing/selftests/kselftest.h
parentbpf: mark registers in all frames after pkt/null checks (diff)
downloadlinux-dev-6dd7f14080473b655c247863e61b7c34424f0c83.tar.xz
linux-dev-6dd7f14080473b655c247863e61b7c34424f0c83.zip
selftests/bpf: test cases for pkt/null checks in subprogs
The first test case, for pointer null checks, is equivalent to the following pseudo-code. It checks that the verifier does not complain on line 6 and recognizes that ptr isn't null. 1: ptr = bpf_map_lookup_elem(map, &key); 2: ret = subprog(ptr) { 3: return ptr != NULL; 4: } 5: if (ret) 6: value = *ptr; The second test case, for packet bound checks, is equivalent to the following pseudo-code. It checks that the verifier does not complain on line 7 and recognizes that the packet is at least 1 byte long. 1: pkt_end = ctx.pkt_end; 2: ptr = ctx.pkt + 8; 3: ret = subprog(ptr, pkt_end) { 4: return ptr <= pkt_end; 5: } 6: if (ret) 7: value = *(u8 *)ctx.pkt; Signed-off-by: Paul Chaignon <paul.chaignon@orange.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/kselftest.h')
0 files changed, 0 insertions, 0 deletions