Skip to content

fix __retval() being always ignored

Eduard Zingerman bpf 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4selftests/bpf: disable program test run for progs/refcounted_kptr.ctools/testing/selftests/bpf/progs/refcounted_kptr.c+4 -40 repliesApplied
2/4selftests/bpf: fix __retval() being always ignoredtools/testing/selftests/bpf/progs/verifier_array_access.c tools/testing/selftests/bpf/test_loader.c+3 -30 repliesApplied
3/4selftests/bpf: add pre bpf_prog_test_run_opts() callback for test_loadertools/testing/selftests/bpf/test_loader.c tools/testing/selftests/bpf/test_progs.h+17 -00 repliesApplied
4/4selftests/bpf: populate map_array_ro map for verifier_array_access testtools/testing/selftests/bpf/prog_tests/verifier.c tools/testing/selftests/bpf/progs/verifier_array_access.c+41 -50 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/4] fix __retval() being always ignored

Florian Westphal found a bug in test_loader.c processing of __retval tag. Because of this bug the function test_loader.c:do_prog_test_run() never executed and all __retval test tags were ignored. See [1].

Fix for this bug uncovers two additional bugs:
- During test_verifier tests migration to inline assembly (see [2]) I missed the fact that some tests require maps to contain mock values;
- Some issue with a new refcounted_kptr test, which causes kernel to produce dead lock and refcount saturation warnings when subject to libbpf's bpf_test_run_opts().

This series fixes the bug in __retval() processing, and address the issue with test maps not being populated. The issue in refcounted_kptr is not addressed, __retval tags in those tests are commented out.

I found that the following tests depend on test maps being populated:
- progs/verifier_array_access.c
- verifier/value_ptr_arith.c (planned for migration to inline assembly)

Given the small amount of these tests I decided to opt for simple non-generic solution (see patch #4).

[1] https://lore.kernel.org/bpf/[email protected]/T/
[2] https://lore.kernel.org/bpf/[email protected]/

Eduard Zingerman (4):
selftests/bpf: disable program test run for progs/refcounted_kptr.c selftests/bpf: fix __retval() being always ignored selftests/bpf: add pre bpf_prog_test_run_opts() callback for
test_loader
selftests/bpf: populate map_array_ro map for verifier_array_access
test

 .../selftests/bpf/prog_tests/verifier.c       | 42 +++++++++++++++++--
 .../selftests/bpf/progs/refcounted_kptr.c     |  8 ++--
 tools/testing/selftests/bpf/test_loader.c     | 10 ++++-
 tools/testing/selftests/bpf/test_progs.h      |  9 ++++
 4 files changed, 61 insertions(+), 8 deletions(-)
Signature · 1 line
2.40.0