v1->v2: - addressed review comments from Song, Andrii, Yonghong - fixed memory leak in error path - added modified ctx check - added more tests in patch 7 v1: Introduce static vs global functions and function by function verification. This is another step toward dynamic re-linking (or replacement) of global functions. See patch 3 for details. The rest are supporting patches. Alexei Starovoitov (7): libbpf: Sanitize global functions libbpf: Collect static vs global info about functions bpf: Introduce function-by-function verification selftests/bpf: Add fexit-to-skb test for global funcs selftests/bpf: Add a test for a large global function selftests/bpf: Modify a test to check global functions selftests/bpf: Add unit tests for global functions include/linux/bpf.h | 7 +- include/linux/bpf_verifier.h | 10 +- include/uapi/linux/btf.h | 6 + kernel/bpf/btf.c | 175 +++++++++--- kernel/bpf/verifier.c | 254 ++++++++++++++---- tools/include/uapi/linux/btf.h | 6 + tools/lib/bpf/btf.h | 5 + tools/lib/bpf/libbpf.c | 150 ++++++++++- .../bpf/prog_tests/bpf_verif_scale.c | 2 + .../selftests/bpf/prog_tests/fexit_bpf2bpf.c | 1 + .../bpf/prog_tests/test_global_funcs.c | 81 ++++++ .../selftests/bpf/progs/fexit_bpf2bpf.c | 15 ++ tools/testing/selftests/bpf/progs/pyperf.h | 9 +- .../selftests/bpf/progs/pyperf_global.c | 5 + .../selftests/bpf/progs/test_global_func1.c | 45 ++++ .../selftests/bpf/progs/test_global_func2.c | 4 + .../selftests/bpf/progs/test_global_func3.c | 65 +++++ .../selftests/bpf/progs/test_global_func4.c | 4 + .../selftests/bpf/progs/test_global_func5.c | 31 +++ .../selftests/bpf/progs/test_global_func6.c | 31 +++ .../selftests/bpf/progs/test_pkt_access.c | 28 ++ .../selftests/bpf/progs/test_xdp_noinline.c | 4 +- 22 files changed, 845 insertions(+), 93 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/test_global_funcs.c create mode 100644 tools/testing/selftests/bpf/progs/pyperf_global.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func1.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func2.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func3.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func4.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func5.c create mode 100644 tools/testing/selftests/bpf/progs/test_global_func6.c -- 2.23.0