OSDN Git Service

bpf: Add selftest cases for ctx_or_null argument type
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 27 Mar 2020 15:58:56 +0000 (16:58 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 28 Mar 2020 02:40:39 +0000 (19:40 -0700)
commit23599ada0e9173e92d3cc26254b1e18e542c469d
tree32f01659caf64cb51f6e92cb178eb2dde502a906
parent834ebca8456c5f7a03d3351227b7c59318ccab62
bpf: Add selftest cases for ctx_or_null argument type

Add various tests to make sure the verifier keeps catching them:

  # ./test_verifier
  [...]
  #230/p pass ctx or null check, 1: ctx OK
  #231/p pass ctx or null check, 2: null OK
  #232/p pass ctx or null check, 3: 1 OK
  #233/p pass ctx or null check, 4: ctx - const OK
  #234/p pass ctx or null check, 5: null (connect) OK
  #235/p pass ctx or null check, 6: null (bind) OK
  #236/p pass ctx or null check, 7: ctx (bind) OK
  #237/p pass ctx or null check, 8: null (bind) OK
  [...]
  Summary: 1595 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/c74758d07b1b678036465ef7f068a49e9efd3548.1585323121.git.daniel@iogearbox.net
tools/testing/selftests/bpf/verifier/ctx.c