* [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests
@ 2025-04-25 8:12 Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test Shung-Hsi Yu
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Shung-Hsi Yu @ 2025-04-25 8:12 UTC (permalink / raw)
To: stable
Cc: Shigeru Yoshida, Alexis Lothoré, Alexei Starovoitov,
Martin KaFai Lau, Shung-Hsi Yu
This patchset backport commit to fix BPF selftests failure in stable
6.12 since commit 972bafed67ca ("bpf, test_run: Fix use-after-free issue
in eth_skb_pkt_type()"), which is backport of upstream commit
6b3d638ca897.
The fix needed is upstream commit c7f2188d68c1 ("selftests/bpf: Adjust
data size to have ETH_HLEN"), which in turn depends on upstream commit
d5fbcf46ee82 "selftests/bpf: make xdp_cpumap_attach keep redirect prog
attached". Latter is part of "selftests/bpf: add coverage for
xdp_features in test_progs"[1], and I opt to backport the series entirely
since it adds coverage. With these patches the xdp_devmap_attach no
longer fails[2].
BPF selftests failure log below for completeness. See [3] for the
raw log.
Error: #566 xdp_devmap_attach
Error: #566/1 xdp_devmap_attach/DEVMAP with programs in entries
test_xdp_with_devmap_helpers:PASS:ip netns add devmap_attach_ns 0 nsec
test_xdp_with_devmap_helpers:PASS:open_netns 0 nsec
test_xdp_with_devmap_helpers:PASS:ip link set dev lo up 0 nsec
test_xdp_with_devmap_helpers:PASS:test_xdp_with_devmap_helpers__open_and_load 0 nsec
test_xdp_with_devmap_helpers:PASS:Generic attach of program with 8-byte devmap 0 nsec
test_xdp_with_devmap_helpers:PASS:bpf_prog_get_info_by_fd 0 nsec
test_xdp_with_devmap_helpers:PASS:Add program to devmap entry 0 nsec
test_xdp_with_devmap_helpers:PASS:Read devmap entry 0 nsec
test_xdp_with_devmap_helpers:PASS:Match program id to devmap entry prog_id 0 nsec
test_xdp_with_devmap_helpers:FAIL:XDP test run unexpected error: -22 (errno 22)
test_xdp_with_devmap_helpers:PASS:XDP program detach 0 nsec
libbpf: Kernel error message: BPF_XDP_DEVMAP programs can not be attached to a device
test_xdp_with_devmap_helpers:PASS:Attach of BPF_XDP_DEVMAP program 0 nsec
test_xdp_with_devmap_helpers:PASS:Add non-BPF_XDP_DEVMAP program to devmap entry 0 nsec
test_xdp_with_devmap_helpers:PASS:Add BPF_XDP program with frags to devmap entry 0 nsec
Error: #566/4 xdp_devmap_attach/DEVMAP with programs in entries on veth
test_xdp_with_devmap_helpers_veth:PASS:ip netns add devmap_attach_ns 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:open_netns 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:ip link add veth_src type veth peer name veth_dst 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:ip link set dev veth_src up 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:ip link set dev veth_dst up 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:val.ifindex 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:ifindex_dst 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:test_xdp_with_devmap_helpers__open_and_load 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:Attach of program with 8-byte devmap 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:bpf_prog_get_info_by_fd 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:Add program to devmap entry 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:Read devmap entry 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:Match program id to devmap entry prog_id 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:Attach of dummy XDP 0 nsec
test_xdp_with_devmap_helpers_veth:FAIL:XDP test run unexpected error: -22 (errno 22)
test_xdp_with_devmap_helpers_veth:PASS:XDP program detach 0 nsec
test_xdp_with_devmap_helpers_veth:PASS:XDP program detach 0 nsec
1: https://lore.kernel.org/all/20241009-convert_xdp_tests-v3-0-51cea913710c@bootlin.com/
2: https://github.com/shunghsiyu/libbpf/actions/runs/14569651139/job/40864428776
3: https://github.com/shunghsiyu/libbpf/actions/runs/14562221313/job/40846927566
Alexis Lothoré (eBPF Foundation) (3):
selftests/bpf: fix bpf_map_redirect call for cpu map test
selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
selftests/bpf: check program redirect in xdp_cpumap_attach
Shigeru Yoshida (1):
selftests/bpf: Adjust data size to have ETH_HLEN
.../bpf/prog_tests/xdp_cpumap_attach.c | 44 +++++++++++++++----
.../bpf/prog_tests/xdp_devmap_attach.c | 8 ++--
.../bpf/progs/test_xdp_with_cpumap_helpers.c | 7 ++-
3 files changed, 46 insertions(+), 13 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test
2025-04-25 8:12 [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests Shung-Hsi Yu
@ 2025-04-25 8:12 ` Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached Shung-Hsi Yu
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Shung-Hsi Yu @ 2025-04-25 8:12 UTC (permalink / raw)
To: stable
Cc: Shigeru Yoshida, Alexis Lothoré, Alexei Starovoitov,
Martin KaFai Lau, Shung-Hsi Yu
From: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
commit ac8d16b2d3772934f4cba44cb01bad05b4b2864c upstream.
xdp_redir_prog currently redirects packets based on the entry at index 1
in cpu_map, but the corresponding test only manipulates the entry at
index 0. This does not really affect the test in its current form since
the program is detached before having the opportunity to execute, but it
needs to be fixed before being able improve the corresponding test (ie,
not only test attach/detach but also the redirect feature)
Fix this XDP program by making it redirect packets based on entry 0 in
cpu_map instead of entry 1.
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-1-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
index 20ec6723df18..d848fe96924e 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
@@ -15,7 +15,7 @@ struct {
SEC("xdp")
int xdp_redir_prog(struct xdp_md *ctx)
{
- return bpf_redirect_map(&cpu_map, 1, 0);
+ return bpf_redirect_map(&cpu_map, 0, 0);
}
SEC("xdp")
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
2025-04-25 8:12 [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test Shung-Hsi Yu
@ 2025-04-25 8:12 ` Shung-Hsi Yu
2025-04-26 13:22 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN Shung-Hsi Yu
3 siblings, 1 reply; 9+ messages in thread
From: Shung-Hsi Yu @ 2025-04-25 8:12 UTC (permalink / raw)
To: stable
Cc: Shigeru Yoshida, Alexis Lothoré, Alexei Starovoitov,
Martin KaFai Lau, Shung-Hsi Yu
From: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
commit d5fbcf46ee82574aee443423f3e4132d1154372b upstream.
Current test only checks attach/detach on cpu map type program, and so
does not check that it can be properly executed, neither that it
redirects correctly.
Update the existing test to extend its coverage:
- keep the redirected program loaded
- try to execute it through bpf_prog_test_run_opts with some dummy
context
While at it, bring the following minor improvements:
- isolate test interface in its own namespace
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-2-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Stable-dep-of: c7f2188d68c1 ("selftests/bpf: Adjust data size to have ETH_HLEN")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../bpf/prog_tests/xdp_cpumap_attach.c | 41 +++++++++++++++----
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
index 481626a875d1..88e8a886d1e6 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
@@ -2,35 +2,41 @@
#include <uapi/linux/bpf.h>
#include <linux/if_link.h>
#include <test_progs.h>
+#include <network_helpers.h>
#include "test_xdp_with_cpumap_frags_helpers.skel.h"
#include "test_xdp_with_cpumap_helpers.skel.h"
#define IFINDEX_LO 1
+#define TEST_NS "cpu_attach_ns"
static void test_xdp_with_cpumap_helpers(void)
{
- struct test_xdp_with_cpumap_helpers *skel;
+ struct test_xdp_with_cpumap_helpers *skel = NULL;
struct bpf_prog_info info = {};
__u32 len = sizeof(info);
struct bpf_cpumap_val val = {
.qsize = 192,
};
- int err, prog_fd, map_fd;
+ int err, prog_fd, prog_redir_fd, map_fd;
+ struct nstoken *nstoken = NULL;
__u32 idx = 0;
+ SYS(out_close, "ip netns add %s", TEST_NS);
+ nstoken = open_netns(TEST_NS);
+ if (!ASSERT_OK_PTR(nstoken, "open_netns"))
+ goto out_close;
+ SYS(out_close, "ip link set dev lo up");
+
skel = test_xdp_with_cpumap_helpers__open_and_load();
if (!ASSERT_OK_PTR(skel, "test_xdp_with_cpumap_helpers__open_and_load"))
return;
- prog_fd = bpf_program__fd(skel->progs.xdp_redir_prog);
- err = bpf_xdp_attach(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE, NULL);
+ prog_redir_fd = bpf_program__fd(skel->progs.xdp_redir_prog);
+ err = bpf_xdp_attach(IFINDEX_LO, prog_redir_fd, XDP_FLAGS_SKB_MODE, NULL);
if (!ASSERT_OK(err, "Generic attach of program with 8-byte CPUMAP"))
goto out_close;
- err = bpf_xdp_detach(IFINDEX_LO, XDP_FLAGS_SKB_MODE, NULL);
- ASSERT_OK(err, "XDP program detach");
-
prog_fd = bpf_program__fd(skel->progs.xdp_dummy_cm);
map_fd = bpf_map__fd(skel->maps.cpu_map);
err = bpf_prog_get_info_by_fd(prog_fd, &info, &len);
@@ -45,6 +51,23 @@ static void test_xdp_with_cpumap_helpers(void)
ASSERT_OK(err, "Read cpumap entry");
ASSERT_EQ(info.id, val.bpf_prog.id, "Match program id to cpumap entry prog_id");
+ /* send a packet to trigger any potential bugs in there */
+ char data[10] = {};
+ DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts,
+ .data_in = &data,
+ .data_size_in = 10,
+ .flags = BPF_F_TEST_XDP_LIVE_FRAMES,
+ .repeat = 1,
+ );
+ err = bpf_prog_test_run_opts(prog_redir_fd, &opts);
+ ASSERT_OK(err, "XDP test run");
+
+ /* wait for the packets to be flushed */
+ kern_sync_rcu();
+
+ err = bpf_xdp_detach(IFINDEX_LO, XDP_FLAGS_SKB_MODE, NULL);
+ ASSERT_OK(err, "XDP program detach");
+
/* can not attach BPF_XDP_CPUMAP program to a device */
err = bpf_xdp_attach(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE, NULL);
if (!ASSERT_NEQ(err, 0, "Attach of BPF_XDP_CPUMAP program"))
@@ -65,6 +88,8 @@ static void test_xdp_with_cpumap_helpers(void)
ASSERT_NEQ(err, 0, "Add BPF_XDP program with frags to cpumap entry");
out_close:
+ close_netns(nstoken);
+ SYS_NOFAIL("ip netns del %s", TEST_NS);
test_xdp_with_cpumap_helpers__destroy(skel);
}
@@ -111,7 +136,7 @@ static void test_xdp_with_cpumap_frags_helpers(void)
test_xdp_with_cpumap_frags_helpers__destroy(skel);
}
-void serial_test_xdp_cpumap_attach(void)
+void test_xdp_cpumap_attach(void)
{
if (test__start_subtest("CPUMAP with programs in entries"))
test_xdp_with_cpumap_helpers();
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach
2025-04-25 8:12 [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached Shung-Hsi Yu
@ 2025-04-25 8:12 ` Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN Shung-Hsi Yu
3 siblings, 1 reply; 9+ messages in thread
From: Shung-Hsi Yu @ 2025-04-25 8:12 UTC (permalink / raw)
To: stable
Cc: Shigeru Yoshida, Alexis Lothoré, Alexei Starovoitov,
Martin KaFai Lau, Shung-Hsi Yu
From: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
commit d124d984c8a2d677e1cea6740a01ccdd0371a38d upstream.
xdp_cpumap_attach, in its current form, only checks that an xdp cpumap
program can be executed, but not that it performs correctly the cpu
redirect as configured by userspace (bpf_prog_test_run_opts will return
success even if the redirect program returns an error)
Add a check to ensure that the program performs the configured redirect
as well. The check is based on a global variable incremented by a
chained program executed only if the redirect program properly executes.
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-3-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 5 ++++-
.../selftests/bpf/progs/test_xdp_with_cpumap_helpers.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
index 88e8a886d1e6..c7f74f068e78 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
@@ -62,8 +62,11 @@ static void test_xdp_with_cpumap_helpers(void)
err = bpf_prog_test_run_opts(prog_redir_fd, &opts);
ASSERT_OK(err, "XDP test run");
- /* wait for the packets to be flushed */
+ /* wait for the packets to be flushed, then check that redirect has been
+ * performed
+ */
kern_sync_rcu();
+ ASSERT_NEQ(skel->bss->redirect_count, 0, "redirected packets");
err = bpf_xdp_detach(IFINDEX_LO, XDP_FLAGS_SKB_MODE, NULL);
ASSERT_OK(err, "XDP program detach");
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
index d848fe96924e..3619239b01b7 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
@@ -12,6 +12,8 @@ struct {
__uint(max_entries, 4);
} cpu_map SEC(".maps");
+__u32 redirect_count = 0;
+
SEC("xdp")
int xdp_redir_prog(struct xdp_md *ctx)
{
@@ -27,6 +29,9 @@ int xdp_dummy_prog(struct xdp_md *ctx)
SEC("xdp/cpumap")
int xdp_dummy_cm(struct xdp_md *ctx)
{
+ if (bpf_get_smp_processor_id() == 0)
+ redirect_count++;
+
if (ctx->ingress_ifindex == IFINDEX_LO)
return XDP_DROP;
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN
2025-04-25 8:12 [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests Shung-Hsi Yu
` (2 preceding siblings ...)
2025-04-25 8:12 ` [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach Shung-Hsi Yu
@ 2025-04-25 8:12 ` Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
3 siblings, 1 reply; 9+ messages in thread
From: Shung-Hsi Yu @ 2025-04-25 8:12 UTC (permalink / raw)
To: stable
Cc: Shigeru Yoshida, Alexis Lothoré, Alexei Starovoitov,
Martin KaFai Lau, Shung-Hsi Yu
From: Shigeru Yoshida <syoshida@redhat.com>
commit c7f2188d68c114095660a950b7e880a1e5a71c8f upstream.
The function bpf_test_init() now returns an error if user_size
(.data_size_in) is less than ETH_HLEN, causing the tests to
fail. Adjust the data size to ensure it meets the requirement of
ETH_HLEN.
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250121150643.671650-2-syoshida@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Fixes: 972bafed67ca ("bpf, test_run: Fix use-after-free issue in eth_skb_pkt_type()")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | 4 ++--
.../testing/selftests/bpf/prog_tests/xdp_devmap_attach.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
index c7f74f068e78..df27535995af 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
@@ -52,10 +52,10 @@ static void test_xdp_with_cpumap_helpers(void)
ASSERT_EQ(info.id, val.bpf_prog.id, "Match program id to cpumap entry prog_id");
/* send a packet to trigger any potential bugs in there */
- char data[10] = {};
+ char data[ETH_HLEN] = {};
DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts,
.data_in = &data,
- .data_size_in = 10,
+ .data_size_in = sizeof(data),
.flags = BPF_F_TEST_XDP_LIVE_FRAMES,
.repeat = 1,
);
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c b/tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c
index 27ffed17d4be..461ab18705d5 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c
@@ -23,7 +23,7 @@ static void test_xdp_with_devmap_helpers(void)
__u32 len = sizeof(info);
int err, dm_fd, dm_fd_redir, map_fd;
struct nstoken *nstoken = NULL;
- char data[10] = {};
+ char data[ETH_HLEN] = {};
__u32 idx = 0;
SYS(out_close, "ip netns add %s", TEST_NS);
@@ -58,7 +58,7 @@ static void test_xdp_with_devmap_helpers(void)
/* send a packet to trigger any potential bugs in there */
DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts,
.data_in = &data,
- .data_size_in = 10,
+ .data_size_in = sizeof(data),
.flags = BPF_F_TEST_XDP_LIVE_FRAMES,
.repeat = 1,
);
@@ -158,7 +158,7 @@ static void test_xdp_with_devmap_helpers_veth(void)
struct nstoken *nstoken = NULL;
__u32 len = sizeof(info);
int err, dm_fd, dm_fd_redir, map_fd, ifindex_dst;
- char data[10] = {};
+ char data[ETH_HLEN] = {};
__u32 idx = 0;
SYS(out_close, "ip netns add %s", TEST_NS);
@@ -208,7 +208,7 @@ static void test_xdp_with_devmap_helpers_veth(void)
/* send a packet to trigger any potential bugs in there */
DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts,
.data_in = &data,
- .data_size_in = 10,
+ .data_size_in = sizeof(data),
.flags = BPF_F_TEST_XDP_LIVE_FRAMES,
.repeat = 1,
);
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
2025-04-25 8:12 ` [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached Shung-Hsi Yu
@ 2025-04-26 13:22 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2025-04-26 13:22 UTC (permalink / raw)
To: stable; +Cc: Shung-Hsi Yu, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: d5fbcf46ee82574aee443423f3e4132d1154372b
WARNING: Author mismatch between patch and upstream commit:
Backport author: Shung-Hsi Yu<shung-hsi.yu@suse.com>
Commit author: Alexis Lothoré (eBPF Foundation)<alexis.lothore@bootlin.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
1: d5fbcf46ee825 ! 1: 25fd958b2c307 selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
@@ Metadata
## Commit message ##
selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
+ commit d5fbcf46ee82574aee443423f3e4132d1154372b upstream.
+
Current test only checks attach/detach on cpu map type program, and so
does not check that it can be properly executed, neither that it
redirects correctly.
@@ Commit message
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-2-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
+ Stable-dep-of: c7f2188d68c1 ("selftests/bpf: Adjust data size to have ETH_HLEN")
+ Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
## tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c ##
@@
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.14.y | Success | Success |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach
2025-04-25 8:12 ` [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach Shung-Hsi Yu
@ 2025-04-26 13:23 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2025-04-26 13:23 UTC (permalink / raw)
To: stable; +Cc: Shung-Hsi Yu, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: d124d984c8a2d677e1cea6740a01ccdd0371a38d
WARNING: Author mismatch between patch and upstream commit:
Backport author: Shung-Hsi Yu<shung-hsi.yu@suse.com>
Commit author: Alexis Lothoré (eBPF Foundation)<alexis.lothore@bootlin.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
1: d124d984c8a2d ! 1: 6678a2106ae30 selftests/bpf: check program redirect in xdp_cpumap_attach
@@ Metadata
## Commit message ##
selftests/bpf: check program redirect in xdp_cpumap_attach
+ commit d124d984c8a2d677e1cea6740a01ccdd0371a38d upstream.
+
xdp_cpumap_attach, in its current form, only checks that an xdp cpumap
program can be executed, but not that it performs correctly the cpu
redirect as configured by userspace (bpf_prog_test_run_opts will return
@@ Commit message
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-3-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
+ Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
## tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c ##
@@ tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c: static void test_xdp_with_cpumap_helpers(void)
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.14.y | Success | Success |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test
2025-04-25 8:12 ` [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test Shung-Hsi Yu
@ 2025-04-26 13:23 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2025-04-26 13:23 UTC (permalink / raw)
To: stable; +Cc: Shung-Hsi Yu, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: ac8d16b2d3772934f4cba44cb01bad05b4b2864c
WARNING: Author mismatch between patch and upstream commit:
Backport author: Shung-Hsi Yu<shung-hsi.yu@suse.com>
Commit author: Alexis Lothoré (eBPF Foundation)<alexis.lothore@bootlin.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
1: ac8d16b2d3772 ! 1: 1118d35b74efb selftests/bpf: fix bpf_map_redirect call for cpu map test
@@ Metadata
## Commit message ##
selftests/bpf: fix bpf_map_redirect call for cpu map test
+ commit ac8d16b2d3772934f4cba44cb01bad05b4b2864c upstream.
+
xdp_redir_prog currently redirects packets based on the entry at index 1
in cpu_map, but the corresponding test only manipulates the entry at
index 0. This does not really affect the test in its current form since
@@ Commit message
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-1-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
+ Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
## tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c ##
@@ tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c: struct {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y | Success | Success |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN
2025-04-25 8:12 ` [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN Shung-Hsi Yu
@ 2025-04-26 13:23 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2025-04-26 13:23 UTC (permalink / raw)
To: stable; +Cc: Shung-Hsi Yu, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected.
No action required from the submitter.
The upstream commit SHA1 provided is correct: c7f2188d68c114095660a950b7e880a1e5a71c8f
WARNING: Author mismatch between patch and upstream commit:
Backport author: Shung-Hsi Yu<shung-hsi.yu@suse.com>
Commit author: Shigeru Yoshida<syoshida@redhat.com>
Status in newer kernel trees:
6.14.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
1: c7f2188d68c11 ! 1: cccb0c9fae094 selftests/bpf: Adjust data size to have ETH_HLEN
@@ Metadata
## Commit message ##
selftests/bpf: Adjust data size to have ETH_HLEN
+ commit c7f2188d68c114095660a950b7e880a1e5a71c8f upstream.
+
The function bpf_test_init() now returns an error if user_size
(.data_size_in) is less than ETH_HLEN, causing the tests to
fail. Adjust the data size to ensure it meets the requirement of
@@ Commit message
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250121150643.671650-2-syoshida@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+ Fixes: 972bafed67ca ("bpf, test_run: Fix use-after-free issue in eth_skb_pkt_type()")
+ Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
## tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c ##
@@ tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c: static void test_xdp_with_cpumap_helpers(void)
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.14.y | Success | Success |
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-04-26 13:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 8:12 [PATCH stable 6.12 0/4] Fix xdp_devmap_attach failure in BPF selftests Shung-Hsi Yu
2025-04-25 8:12 ` [PATCH stable 6.12 1/4] selftests/bpf: fix bpf_map_redirect call for cpu map test Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 2/4] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached Shung-Hsi Yu
2025-04-26 13:22 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 3/4] selftests/bpf: check program redirect in xdp_cpumap_attach Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
2025-04-25 8:12 ` [PATCH stable 6.12 4/4] selftests/bpf: Adjust data size to have ETH_HLEN Shung-Hsi Yu
2025-04-26 13:23 ` Sasha Levin
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.