BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org
Cc: andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
	kernel-team@fb.com, yhs@fb.com,
	Eduard Zingerman <eddyz87@gmail.com>
Subject: [PATCH bpf-next 0/4] fix __retval() being always ignored
Date: Fri, 21 Apr 2023 02:23:13 +0300	[thread overview]
Message-ID: <20230420232317.2181776-1-eddyz87@gmail.com> (raw)

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/f4c4aee644425842ee6aa8edf1da68f0a8260e7c.camel@gmail.com/T/
[2] https://lore.kernel.org/bpf/20230325025524.144043-1-eddyz87@gmail.com/

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(-)

-- 
2.40.0


             reply	other threads:[~2023-04-20 23:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 23:23 Eduard Zingerman [this message]
2023-04-20 23:23 ` [PATCH bpf-next 1/4] selftests/bpf: disable program test run for progs/refcounted_kptr.c Eduard Zingerman
2023-04-20 23:23 ` [PATCH bpf-next 2/4] selftests/bpf: fix __retval() being always ignored Eduard Zingerman
2023-04-20 23:23 ` [PATCH bpf-next 3/4] selftests/bpf: add pre bpf_prog_test_run_opts() callback for test_loader Eduard Zingerman
2023-04-20 23:23 ` [PATCH bpf-next 4/4] selftests/bpf: populate map_array_ro map for verifier_array_access test Eduard Zingerman
2023-04-21  2:00 ` [PATCH bpf-next 0/4] fix __retval() being always ignored patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420232317.2181776-1-eddyz87@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox