]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, selftests: Add test case trying to taint map value pointer
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 15 Dec 2021 23:48:54 +0000 (23:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Dec 2021 08:32:35 +0000 (09:32 +0100)
commitd2c6e9c1a89689a2403bfa6791623e9dc673eb16
treef80eaf2ed2875f6b41009a929fe22fed47cffa74
parentff780e16bd2103bf5b391cc8693d379ce09f79f4
bpf, selftests: Add test case trying to taint map value pointer

commit bbf4723f4203ec460a8964b30b2d3a3fef5dc93e upstream.

Add a test case which tries to taint map value pointer arithmetic into a
unknown scalar with subsequent export through the map.

Before fix:

  # ./test_verifier 1186
  #1186/u map access: trying to leak tained dst reg FAIL
  Unexpected success to load!
  verification time 24 usec
  stack depth 8
  processed 15 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1
  #1186/p map access: trying to leak tained dst reg FAIL
  Unexpected success to load!
  verification time 8 usec
  stack depth 8
  processed 15 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1
  Summary: 0 PASSED, 0 SKIPPED, 2 FAILED

After fix:

  # ./test_verifier 1186
  #1186/u map access: trying to leak tained dst reg OK
  #1186/p map access: trying to leak tained dst reg OK
  Summary: 2 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/bpf/verifier/value_ptr_arith.c