mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
Merge branch 'selftests-bpf-a-few-edge-case-fixes'
Ricardo B. Marlière says:
====================
selftests/bpf: A few edge case fixes
Hi,
Please consider merging the following fixes, found by means of targeting
BPF selftests through openQA [1].
[1]: e.g. https://openqa.opensuse.org/tests/6087703
1/4 ("libbpf: Search /lib64 and /lib in resolve_full_path()")
- Hit by testing an older SLES root filesystem.
2/4 ("selftests/bpf: Fix lsm_bdev dev_t encoding mismatch")
- https://openqa.opensuse.org/tests/6087703/logfile?filename=test_progs.tap.txt#line-2706
3/4 ("selftests/bpf: Install resolve_btfids.test.o.BTF where the test expects it")
- https://openqa.opensuse.org/tests/6087703/logfile?filename=test_progs.tap.txt#line-3332
4/4 ("selftests/bpf: Install bpftool where test_progs expects to find it")
- https://openqa.opensuse.org/tests/6087703/logfile?filename=test_progs.tap.txt#line-806
- https://openqa.opensuse.org/tests/6087703#step/test_bpftool_build_sh/1
- https://openqa.opensuse.org/tests/6087703#step/test_doc_build_sh/1
The build process is done at runtime with BPF_STRICT_BUILD=0:
https://openqa.opensuse.org/tests/6087703/logfile?filename=serial_terminal.txt#line-1937
Assisted-by: Claude Sonnet 5
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
Changes in v2:
- Squashed first 2 commits
- Removed redundant copy of bpftool due to TEST_GEN_PROGS_EXTENDED
- Installed *.BTF instead of only resolve_btfids.test.o.BTF
- Link to v1: https://patch.msgid.link/20260710-selftests-bpf_fixes-v1-0-aa24dfd6f4f9@suse.com
To: Andrii Nakryiko <andrii@kernel.org>
To: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <ast@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Martin KaFai Lau <martin.lau@linux.dev>
To: Song Liu <song@kernel.org>
To: Yonghong Song <yonghong.song@linux.dev>
To: Jiri Olsa <jolsa@kernel.org>
To: Emil Tsalapatis <emil@etsalapatis.com>
To: Shuah Khan <shuah@kernel.org>
To: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>
To: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Christian Brauner <brauner@kernel.org>
Cc: bpf@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Ricardo B. Marlière (3):
selftests/bpf: Fix make install target
selftests/bpf: Fix lsm_bdev dev_t encoding mismatch
libbpf: Search /lib64 and /lib in resolve_full_path()
tools/lib/bpf/libbpf.c | 3 ++-
tools/testing/selftests/bpf/Makefile | 7 ++++---
tools/testing/selftests/bpf/prog_tests/lsm_bdev.c | 3 ++-
3 files changed, 8 insertions(+), 5 deletions(-)
---
base-commit: 1590cf0329
change-id: 20260710-selftests-bpf_fixes-06e9a2eb3c67
Best regards,
--
Ricardo B. Marlière <rbm@suse.com>
====================
Link: https://patch.msgid.link/20260720-selftests-bpf_fixes-v2-0-b450eda93dfe@suse.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
This commit is contained in:
@@ -12969,13 +12969,14 @@ static const char *arch_specific_lib_paths(void)
|
||||
/* Get full path to program/shared library. */
|
||||
static int resolve_full_path(const char *file, char *result, size_t result_sz)
|
||||
{
|
||||
const char *search_paths[3] = {};
|
||||
const char *search_paths[4] = {};
|
||||
int i, perm;
|
||||
|
||||
if (str_has_sfx(file, ".so") || strstr(file, ".so.")) {
|
||||
search_paths[0] = getenv("LD_LIBRARY_PATH");
|
||||
search_paths[1] = "/usr/lib64:/usr/lib";
|
||||
search_paths[2] = arch_specific_lib_paths();
|
||||
search_paths[3] = "/lib64:/lib";
|
||||
perm = R_OK;
|
||||
} else {
|
||||
search_paths[0] = getenv("PATH");
|
||||
|
||||
@@ -324,8 +324,6 @@ TRUNNER_BPFTOOL := $(DEFAULT_BPFTOOL)
|
||||
USE_BOOTSTRAP := "bootstrap/"
|
||||
endif
|
||||
|
||||
TEST_GEN_PROGS_EXTENDED += $(TRUNNER_BPFTOOL)
|
||||
|
||||
$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
|
||||
|
||||
TESTING_HELPERS := $(OUTPUT)/testing_helpers.o
|
||||
@@ -1055,10 +1053,13 @@ endif
|
||||
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
|
||||
override define INSTALL_RULE
|
||||
$(DEFAULT_INSTALL_RULE)
|
||||
@mkdir -p $(INSTALL_PATH)/tools/sbin
|
||||
@rsync -a $(if $(PERMISSIVE),--ignore-missing-args) $(TRUNNER_BPFTOOL) $(INSTALL_PATH)/tools/sbin/
|
||||
@rsync -a $(if $(PERMISSIVE),--ignore-missing-args) $(OUTPUT)/*.BTF $(INSTALL_PATH)/
|
||||
@for DIR in $(TEST_INST_SUBDIRS); do \
|
||||
mkdir -p $(INSTALL_PATH)/$$DIR; \
|
||||
rsync -a $(if $(PERMISSIVE),--ignore-missing-args) \
|
||||
$(OUTPUT)/$$DIR/*.bpf.o \
|
||||
$(OUTPUT)/$$DIR/*.bpf.o $(OUTPUT)/$$DIR/*.BTF \
|
||||
$(INSTALL_PATH)/$$DIR; \
|
||||
done
|
||||
endef
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "lsm_bdev.skel.h"
|
||||
@@ -172,7 +173,7 @@ void test_lsm_bdev(void)
|
||||
if (!ASSERT_OK(stat(DM_DEV_PATH, &st), "stat dm dev"))
|
||||
goto remove_dm;
|
||||
|
||||
dev_key = (__u32)st.st_rdev;
|
||||
dev_key = (major(st.st_rdev) << 20) | minor(st.st_rdev);
|
||||
|
||||
/* Look up the device in the BPF map and verify. */
|
||||
err = bpf_map__lookup_elem(skel->maps.verity_devices,
|
||||
|
||||
Reference in New Issue
Block a user