On 02/15, Andrii Nakryiko wrote:
Fix kernel bug in determining whether global subprog's argument is
PTR_TO_CTX,
which is done based on type names. Currently KPROBE programs are broken.
Add few tests validating that KPROBE context can be passed to global
subprog.
For that also refactor test_global_funcs test to use test_loader
framework.
v1->v2:
- fix compilation warning on arm64 and s390x by force-casting ctx to
`void *`, to discard const from `const struct user_pt_regs *`, when
passing it to bpf_get_stack().
Such a shame there isn't something like unconstify(typeof(xxx)) :-(
But thank you for catching this. Need to build a habit of looking at
the buildbot output.
Reposting for patchwork:
Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
Andrii Nakryiko (3):
bpf: fix global subprog context argument resolution logic
selftests/bpf: convert test_global_funcs test to test_loader framework
selftests/bpf: add global subprog context passing tests
kernel/bpf/btf.c | 13 +-
.../bpf/prog_tests/test_global_funcs.c | 133 +++++-------------
.../selftests/bpf/progs/test_global_func1.c | 6 +-
.../selftests/bpf/progs/test_global_func10.c | 4 +-
.../selftests/bpf/progs/test_global_func11.c | 4 +-
.../selftests/bpf/progs/test_global_func12.c | 4 +-
.../selftests/bpf/progs/test_global_func13.c | 4 +-
.../selftests/bpf/progs/test_global_func14.c | 4 +-
.../selftests/bpf/progs/test_global_func15.c | 4 +-
.../selftests/bpf/progs/test_global_func16.c | 4 +-
.../selftests/bpf/progs/test_global_func17.c | 4 +-
.../selftests/bpf/progs/test_global_func2.c | 43 +++++-
.../selftests/bpf/progs/test_global_func3.c | 10 +-
.../selftests/bpf/progs/test_global_func4.c | 55 +++++++-
.../selftests/bpf/progs/test_global_func5.c | 4 +-
.../selftests/bpf/progs/test_global_func6.c | 4 +-
.../selftests/bpf/progs/test_global_func7.c | 4 +-
.../selftests/bpf/progs/test_global_func8.c | 4 +-
.../selftests/bpf/progs/test_global_func9.c | 4 +-
.../bpf/progs/test_global_func_ctx_args.c | 105 ++++++++++++++
20 files changed, 292 insertions(+), 125 deletions(-)
create mode 100644
tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c
--
2.30.2