selftests/bpf: Test bpf_core_types_are_compat() functionality.
authorMatteo Croce <mcroce@microsoft.com>
Fri, 4 Feb 2022 00:55:19 +0000 (01:55 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Feb 2022 19:29:01 +0000 (11:29 -0800)
commit976a38e05a49f401cf9ae3ae20273db6d69783cf
treeaacf4465982ac8e65482c3e844d161e4b360a33b
parente70e13e7d4ab8f932f49db1c9500b30a34a6d420
selftests/bpf: Test bpf_core_types_are_compat() functionality.

Add several tests to check bpf_core_types_are_compat() functionality:
- candidate type name exists and types match
- candidate type name exists but types don't match
- nested func protos at kernel recursion limit
- nested func protos above kernel recursion limit. Such bpf prog
  is rejected during the load.

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220204005519.60361-3-mcroce@linux.microsoft.com
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/prog_tests/core_kern.c
tools/testing/selftests/bpf/prog_tests/core_kern_overflow.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/core_kern.c
tools/testing/selftests/bpf/progs/core_kern_overflow.c [new file with mode: 0644]