* [PATCH v2 0/3] selftests/bpf: A few edge case fixes
@ 2026-07-20 11:13 Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 1/3] selftests/bpf: Fix make install target Ricardo B. Marlière
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ricardo B. Marlière @ 2026-07-20 11:13 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan,
Alexis Lothoré (eBPF Foundation), Ihor Solodrai,
Christian Brauner
Cc: bpf, linux-kselftest, linux-kernel, Ricardo B. Marlière
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: 1590cf0329716306e948a8fc29f1d3ee87d3989f
change-id: 20260710-selftests-bpf_fixes-06e9a2eb3c67
Best regards,
--
Ricardo B. Marlière <rbm@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] selftests/bpf: Fix make install target
2026-07-20 11:13 [PATCH v2 0/3] selftests/bpf: A few edge case fixes Ricardo B. Marlière
@ 2026-07-20 11:13 ` Ricardo B. Marlière
2026-07-21 1:19 ` Ihor Solodrai
2026-07-20 11:13 ` [PATCH v2 2/3] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch Ricardo B. Marlière
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Ricardo B. Marlière @ 2026-07-20 11:13 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan,
Alexis Lothoré (eBPF Foundation), Ihor Solodrai,
Christian Brauner
Cc: bpf, linux-kselftest, linux-kernel, Ricardo B. Marlière
After "make install", test_progs fails because two files end up in the
wrong place:
- bpftool: TEST_GEN_PROGS_EXTENDED flattens it into $(INSTALL_PATH), losing
the tools/sbin/ prefix that detect_bpftool_path() expects. Remove it from
TEST_GEN_PROGS_EXTENDED and install it explicitly under tools/sbin/
instead.
- *.BTF: resolve_btfids writes resolve_btfids.test.o.BTF as a side-effect
of the build but INSTALL_RULE never copies it over. Install all *.BTF
files alongside the rest of the per-flavor output.
Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
tools/testing/selftests/bpf/Makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index b642ee489ea6..55d394438705 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -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
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch
2026-07-20 11:13 [PATCH v2 0/3] selftests/bpf: A few edge case fixes Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 1/3] selftests/bpf: Fix make install target Ricardo B. Marlière
@ 2026-07-20 11:13 ` Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 3/3] libbpf: Search /lib64 and /lib in resolve_full_path() Ricardo B. Marlière
2026-07-21 17:30 ` [PATCH v2 0/3] selftests/bpf: A few edge case fixes patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Ricardo B. Marlière @ 2026-07-20 11:13 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan,
Alexis Lothoré (eBPF Foundation), Ihor Solodrai,
Christian Brauner
Cc: bpf, linux-kselftest, linux-kernel, Ricardo B. Marlière
progs/lsm_bdev.c keys its verity_devices hashmap with the raw kernel dev_t
read straight off bdev->bd_dev, i.e. MKDEV(major, minor) = (major << 20) |
minor. prog_tests/lsm_bdev.c instead builds its lookup key with dev_key =
(__u32)st.st_rdev from stat(2), but the stat(2) syscall fills st_rdev via
the kernel's new_encode_dev(), a different bit layout: (minor & 0xff) |
(major << 8) | ((minor & ~0xff) << 12).
For any device with a non-trivial major these two values differ, so the
lookup can never find what the BPF program stored, and test_lsm_bdev()
always fails with:
test_lsm_bdev:FAIL:map lookup unexpected error: -2 (errno 2)
Reconstruct the raw kernel dev_t from the decoded major/minor instead of
casting st_rdev directly, restoring the layout the BPF program actually
reads.
Fixes: 96f4c251a087 ("selftests/bpf: add block device management selftests")
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
tools/testing/selftests/bpf/prog_tests/lsm_bdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/lsm_bdev.c b/tools/testing/selftests/bpf/prog_tests/lsm_bdev.c
index a970798e1173..28bc4b117f41 100644
--- a/tools/testing/selftests/bpf/prog_tests/lsm_bdev.c
+++ b/tools/testing/selftests/bpf/prog_tests/lsm_bdev.c
@@ -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,
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] libbpf: Search /lib64 and /lib in resolve_full_path()
2026-07-20 11:13 [PATCH v2 0/3] selftests/bpf: A few edge case fixes Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 1/3] selftests/bpf: Fix make install target Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 2/3] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch Ricardo B. Marlière
@ 2026-07-20 11:13 ` Ricardo B. Marlière
2026-07-21 17:30 ` [PATCH v2 0/3] selftests/bpf: A few edge case fixes patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Ricardo B. Marlière @ 2026-07-20 11:13 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan,
Alexis Lothoré (eBPF Foundation), Ihor Solodrai,
Christian Brauner
Cc: bpf, linux-kselftest, linux-kernel, Ricardo B. Marlière
attach_probe/uprobe-lib and uprobe_autoattach selftests fail with "failed
to resolve full path for libc.so.6" on older non-usrmerged distros, where
libc.so.6 lives under a top-level /lib64 or /lib rather than /usr/lib64 or
/usr/lib. Add /lib64:/lib to the search paths, alongside the existing
/usr/lib64:/usr/lib and Debian multiarch entries.
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Fixes: 1ce3a60e3c28 ("libbpf: auto-resolve programs/libraries when necessary for uprobes")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
tools/lib/bpf/libbpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 1368752aa13c..1ab939dfb7f0 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -12973,13 +12973,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");
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] selftests/bpf: Fix make install target
2026-07-20 11:13 ` [PATCH v2 1/3] selftests/bpf: Fix make install target Ricardo B. Marlière
@ 2026-07-21 1:19 ` Ihor Solodrai
0 siblings, 0 replies; 6+ messages in thread
From: Ihor Solodrai @ 2026-07-21 1:19 UTC (permalink / raw)
To: Ricardo B. Marlière, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
Emil Tsalapatis, Shuah Khan,
Alexis Lothoré (eBPF Foundation), Christian Brauner
Cc: bpf, linux-kselftest, linux-kernel
On 2026-07-20 4:13 a.m., Ricardo B. Marlière wrote:
> After "make install", test_progs fails because two files end up in the
> wrong place:
>
> - bpftool: TEST_GEN_PROGS_EXTENDED flattens it into $(INSTALL_PATH), losing
> the tools/sbin/ prefix that detect_bpftool_path() expects. Remove it from
> TEST_GEN_PROGS_EXTENDED and install it explicitly under tools/sbin/
> instead.
>
> - *.BTF: resolve_btfids writes resolve_btfids.test.o.BTF as a side-effect
> of the build but INSTALL_RULE never copies it over. Install all *.BTF
> files alongside the rest of the per-flavor output.
>
> Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
> Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Thanks!
> ---
> tools/testing/selftests/bpf/Makefile | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index b642ee489ea6..55d394438705 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] selftests/bpf: A few edge case fixes
2026-07-20 11:13 [PATCH v2 0/3] selftests/bpf: A few edge case fixes Ricardo B. Marlière
` (2 preceding siblings ...)
2026-07-20 11:13 ` [PATCH v2 3/3] libbpf: Search /lib64 and /lib in resolve_full_path() Ricardo B. Marlière
@ 2026-07-21 17:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-21 17:30 UTC (permalink / raw)
To: =?utf-8?b?UmljYXJkbyBCLiBNYXJsacOocmUgPHJibUBzdXNlLmNvbT4=?=
Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
yonghong.song, jolsa, emil, shuah, alexis.lothore, ihor.solodrai,
brauner, bpf, linux-kselftest, linux-kernel
Hello:
This series was applied to bpf/bpf-next.git (master)
by Kumar Kartikeya Dwivedi <memxor@gmail.com>:
On Mon, 20 Jul 2026 08:13:06 -0300 you wrote:
> 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
>
> [...]
Here is the summary with links:
- [v2,1/3] selftests/bpf: Fix make install target
https://git.kernel.org/bpf/bpf-next/c/0b236ac75d04
- [v2,2/3] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch
https://git.kernel.org/bpf/bpf-next/c/71cf3f3275e5
- [v2,3/3] libbpf: Search /lib64 and /lib in resolve_full_path()
https://git.kernel.org/bpf/bpf-next/c/7b5ae0481efd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-21 17:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 11:13 [PATCH v2 0/3] selftests/bpf: A few edge case fixes Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 1/3] selftests/bpf: Fix make install target Ricardo B. Marlière
2026-07-21 1:19 ` Ihor Solodrai
2026-07-20 11:13 ` [PATCH v2 2/3] selftests/bpf: Fix lsm_bdev dev_t encoding mismatch Ricardo B. Marlière
2026-07-20 11:13 ` [PATCH v2 3/3] libbpf: Search /lib64 and /lib in resolve_full_path() Ricardo B. Marlière
2026-07-21 17:30 ` [PATCH v2 0/3] selftests/bpf: A few edge case fixes patchwork-bot+netdevbpf
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.