[PATCH bpf-next v3 0/2] limit bpf_core_types_are_compat recursion

From: Matteo Croce
Date: Thu Feb 03 2022 - 19:55:44 EST


From: Matteo Croce <mcroce@xxxxxxxxxxxxx>

As formerly discussed on the BPF mailing list:
https://lore.kernel.org/bpf/CAADnVQJDax2j0-7uyqdqFEnpB57om_z+Cqmi1O2QyLpHqkVKwA@xxxxxxxxxxxxxx/

changes from v2:
test the bpf_core_type_exists() return value, and check that the recursion
limit is enforced.

Matteo Croce (2):
bpf: limit bpf_core_types_are_compat() recursion
selftests/bpf: test maximum recursion depth for
bpf_core_types_are_compat()

include/linux/btf.h | 5 +
kernel/bpf/btf.c | 105 +++++++++++++++++-
tools/testing/selftests/bpf/Makefile | 2 +-
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 5 +
.../selftests/bpf/prog_tests/core_kern.c | 15 ++-
.../bpf/prog_tests/core_kern_overflow.c | 13 +++
tools/testing/selftests/bpf/progs/core_kern.c | 14 +++
.../selftests/bpf/progs/core_kern_overflow.c | 21 ++++
8 files changed, 177 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/core_kern_overflow.c
create mode 100644 tools/testing/selftests/bpf/progs/core_kern_overflow.c

--
2.34.1