All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 v2 5/5] selftests: bpf: use the bpftool built with the tests in test_bpftool_map
Date: Tue,  1 Sep 2026 02:41:52 +0300	[thread overview]
Message-ID: <20260831234217.1649428-5-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20260831234217.1649428-1-eva.kurchatova@virtuozzo.com>

The test loads a program that denies write access to a map and then
checks that reading it still works. Reading it through a bpftool that
opens the map for writing therefore fails:

  Error: can't get map by id (68627): Operation not permitted
   Read access to 0 0 0 0 in prot_map failed

An installed bpftool v7.5.0 opens the map that way, where the v7.7.0
built alongside the test does not. Prefer the one next to the test and
fall back to $PATH when it is absent.

Commit 2d96bbdfd3b5 ("selftests/bpf: convert
test_bpftool_map_access.sh into test_progs framework") removed this
script upstream, so the change applies to this tree only.

https://virtuozzo.atlassian.net/browse/VSTOR-139677
Feature: fix vz selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/bpf/test_bpftool_map.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_bpftool_map.sh b/tools/testing/selftests/bpf/test_bpftool_map.sh
index 515b1df0501e..e5f5e3b8dc02 100755
--- a/tools/testing/selftests/bpf/test_bpftool_map.sh
+++ b/tools/testing/selftests/bpf/test_bpftool_map.sh
@@ -18,7 +18,16 @@ BPF_DIR="$BPF_FS_PARENT/test_$TESTNAME"
 SCRIPT_DIR=$(dirname $(realpath "$0"))
 BPF_FILE_PATH="$SCRIPT_DIR/$BPF_FILE"
 BPF_ITER_FILE_PATH="$SCRIPT_DIR/$BPF_ITER_FILE"
-BPFTOOL_PATH="bpftool"
+# Prefer the bpftool that was built together with these tests.  The
+# protection checked here needs one that opens a map read only to look
+# it up, and the bpftool of the distribution can be too old for that:
+# it opens the map for writing, the fmod_ret program denies that, and
+# the read is reported as failed.
+if [ -x "$SCRIPT_DIR/bpftool" ]; then
+	BPFTOOL_PATH="$SCRIPT_DIR/bpftool"
+else
+	BPFTOOL_PATH="bpftool"
+fi
 # Assume the script is located under tools/testing/selftests/bpf/
 KDIR_ROOT_DIR=$(realpath "$SCRIPT_DIR"/../../../../)
 
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

      parent reply	other threads:[~2026-08-31 23:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 23:41 [Devel] [PATCH vz10 v2 1/5] ms/selftests/bpf: Use local type for bpf_fou_encap in test_tunnel_kern Eva Kurchatova
2026-08-31 23:41 ` [Devel] [PATCH vz10 v2 2/5] selftests: bpf: run test_xdp_features in its own netns Eva Kurchatova
2026-08-31 23:41 ` [Devel] [PATCH vz10 v2 3/5] selftests: bpf: size the map in test_lru_sanity3 to whole refills Eva Kurchatova
2026-08-31 23:41 ` [Devel] [PATCH vz10 v2 4/5] selftests: bpf: run test_sock and test_tunnel in their own netns Eva Kurchatova
2026-08-31 23:41 ` Eva Kurchatova [this message]

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=20260831234217.1649428-5-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.