]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Cover exclusive map create-time validation
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 3 Jun 2026 21:16:57 +0000 (23:16 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 4 Jun 2026 16:44:42 +0000 (09:44 -0700)
commite87d898bc766a6dc3cec63478b4cdf4e6286aff1
tree887b4d92d9ca25717fe8eefa4072e58b2dc88e43
parent8a7f2bff2165e53595d1e91c160b340f978c0ab7
selftests/bpf: Cover exclusive map create-time validation

map_excl exercises exclusive-map binding (allowed/denied), map-in-map
and map iterator rejection. It does not cover the create-time validation
of excl_prog_hash: the kernel only accepts a SHA-256-sized hash and
requires the pointer and size to be consistent.

Add map_excl_create_validation to check the rejected combinations:

  # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t map_excl
  [...]
  [    1.780305] clocksource: Switched to clocksource tsc
  #215/1   map_excl/map_excl_allowed:OK
  #215/2   map_excl/map_excl_denied:OK
  #215/3   map_excl/map_excl_no_map_in_map:OK
  #215/4   map_excl/map_excl_no_map_iter:OK
  #215/5   map_excl/map_excl_create_validation:OK
  #215     map_excl:OK
  Summary: 1/5 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20260603211658.471212-1-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/map_excl.c