* [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"
@ 2026-02-24 7:38 Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 1/5] selftests/bpf: ns_current_pid_tgid: Rename the test function Shung-Hsi Yu
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable; +Cc: Ricardo B. Marlière, Shung-Hsi Yu
This patchset backport the corresponding BPF selftests for commit
d946f3c98328 ("bpf: Check skb->transport_header is set in
bpf_skb_check_mtu"), which has already been included since 6.12.63.
The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
additionally depends on network namespace support for BPF selftests
added by Bastien, otherwise the MTU in root networking namespace will be
set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
Marlière for figuring out the dependency.
Bastien Curutchet (eBPF Foundation) (4):
selftests/bpf: ns_current_pid_tgid: Rename the test function
selftests/bpf: Optionally open a dedicated namespace to run test in it
selftests/bpf: tc_links/tc_opts: Unserialize tests
selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature
Martin KaFai Lau (1):
selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when
transport_header is not set
.../selftests/bpf/prog_tests/check_mtu.c | 23 ++++++++-
.../bpf/prog_tests/ns_current_pid_tgid.c | 49 +++++++------------
.../selftests/bpf/prog_tests/tc_links.c | 28 +++++------
.../selftests/bpf/prog_tests/tc_opts.c | 40 +++++++--------
.../selftests/bpf/progs/test_check_mtu.c | 12 +++++
tools/testing/selftests/bpf/test_progs.c | 12 +++++
6 files changed, 98 insertions(+), 66 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH stable 6.12 1/5] selftests/bpf: ns_current_pid_tgid: Rename the test function
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
@ 2026-02-24 7:38 ` Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 2/5] selftests/bpf: Optionally open a dedicated namespace to run test in it Shung-Hsi Yu
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable
Cc: Ricardo B. Marlière, Shung-Hsi Yu,
Bastien Curutchet (eBPF Foundation), Alexei Starovoitov
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com>
commit 4a06c5251ae341224e4010795a4db080857545fe upstream.
Next patch will add a new feature to test_prog to run tests in a
dedicated namespace if the test name starts with 'ns_'. Here the test
name already starts with 'ns_' and creates some namespaces which would
conflict with the new feature.
Rename the test to avoid this conflict.
Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Link: https://lore.kernel.org/r/20250219-b4-tc_links-v2-1-14504db136b7@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 6cc73f35406c ("selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
index 761ce24bce38..78020ece6a29 100644
--- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
+++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
@@ -220,7 +220,7 @@ static void test_in_netns(int (*fn)(void *), void *arg)
}
/* TODO: use a different tracepoint */
-void serial_test_ns_current_pid_tgid(void)
+void serial_test_current_pid_tgid(void)
{
if (test__start_subtest("root_ns_tp"))
test_current_pid_tgid_tp(NULL);
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH stable 6.12 2/5] selftests/bpf: Optionally open a dedicated namespace to run test in it
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 1/5] selftests/bpf: ns_current_pid_tgid: Rename the test function Shung-Hsi Yu
@ 2026-02-24 7:38 ` Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 3/5] selftests/bpf: tc_links/tc_opts: Unserialize tests Shung-Hsi Yu
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable
Cc: Ricardo B. Marlière, Shung-Hsi Yu,
Bastien Curutchet (eBPF Foundation), Alexei Starovoitov
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com>
commit c047e0e0e43560bf73ae47f7cfd5772f690b6d48 upstream.
Some tests are serialized to prevent interference with others.
Open a dedicated network namespace when a test name starts with 'ns_' to
allow more test parallelization. Use the test name as namespace name to
avoid conflict between namespaces.
Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Link: https://lore.kernel.org/r/20250219-b4-tc_links-v2-2-14504db136b7@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 6cc73f35406c ("selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
tools/testing/selftests/bpf/test_progs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index fa829a7854f2..1ac1e67798ed 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1252,20 +1252,32 @@ static int recv_message(int sock, struct msg *msg)
return ret;
}
+static bool ns_is_needed(const char *test_name)
+{
+ if (strlen(test_name) < 3)
+ return false;
+
+ return !strncmp(test_name, "ns_", 3);
+}
+
static void run_one_test(int test_num)
{
struct prog_test_def *test = &prog_test_defs[test_num];
struct test_state *state = &test_states[test_num];
+ struct netns_obj *ns = NULL;
env.test = test;
env.test_state = state;
stdio_hijack(&state->log_buf, &state->log_cnt);
+ if (ns_is_needed(test->test_name))
+ ns = netns_new(test->test_name, true);
if (test->run_test)
test->run_test();
else if (test->run_serial_test)
test->run_serial_test();
+ netns_free(ns);
/* ensure last sub-test is finalized properly */
if (env.subtest_state)
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH stable 6.12 3/5] selftests/bpf: tc_links/tc_opts: Unserialize tests
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 1/5] selftests/bpf: ns_current_pid_tgid: Rename the test function Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 2/5] selftests/bpf: Optionally open a dedicated namespace to run test in it Shung-Hsi Yu
@ 2026-02-24 7:38 ` Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 4/5] selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature Shung-Hsi Yu
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable
Cc: Ricardo B. Marlière, Shung-Hsi Yu,
Bastien Curutchet (eBPF Foundation), Alexei Starovoitov
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com>
commit 207cd7578ad16dc033ab55c13ae23d27a67fc0f5 upstream.
Tests are serialized because they all use the loopback interface.
Replace the 'serial_test_' prefixes with 'test_ns_' to benefit from the
new test_prog feature which creates a dedicated namespace for each test,
allowing them to run in parallel.
Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Link: https://lore.kernel.org/r/20250219-b4-tc_links-v2-3-14504db136b7@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 6cc73f35406c ("selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../selftests/bpf/prog_tests/tc_links.c | 28 ++++++-------
.../selftests/bpf/prog_tests/tc_opts.c | 40 +++++++++----------
2 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_links.c b/tools/testing/selftests/bpf/prog_tests/tc_links.c
index 1af9ec1149aa..2186a24e7d8a 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_links.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_links.c
@@ -13,7 +13,7 @@
#include "netlink_helpers.h"
#include "tc_helpers.h"
-void serial_test_tc_links_basic(void)
+void test_ns_tc_links_basic(void)
{
LIBBPF_OPTS(bpf_prog_query_opts, optq);
LIBBPF_OPTS(bpf_tcx_opts, optl);
@@ -260,7 +260,7 @@ static void test_tc_links_before_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_before(void)
+void test_ns_tc_links_before(void)
{
test_tc_links_before_target(BPF_TCX_INGRESS);
test_tc_links_before_target(BPF_TCX_EGRESS);
@@ -414,7 +414,7 @@ static void test_tc_links_after_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_after(void)
+void test_ns_tc_links_after(void)
{
test_tc_links_after_target(BPF_TCX_INGRESS);
test_tc_links_after_target(BPF_TCX_EGRESS);
@@ -514,7 +514,7 @@ static void test_tc_links_revision_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_revision(void)
+void test_ns_tc_links_revision(void)
{
test_tc_links_revision_target(BPF_TCX_INGRESS);
test_tc_links_revision_target(BPF_TCX_EGRESS);
@@ -618,7 +618,7 @@ static void test_tc_chain_classic(int target, bool chain_tc_old)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_chain_classic(void)
+void test_ns_tc_links_chain_classic(void)
{
test_tc_chain_classic(BPF_TCX_INGRESS, false);
test_tc_chain_classic(BPF_TCX_EGRESS, false);
@@ -846,7 +846,7 @@ static void test_tc_links_replace_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_replace(void)
+void test_ns_tc_links_replace(void)
{
test_tc_links_replace_target(BPF_TCX_INGRESS);
test_tc_links_replace_target(BPF_TCX_EGRESS);
@@ -1158,7 +1158,7 @@ static void test_tc_links_invalid_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_invalid(void)
+void test_ns_tc_links_invalid(void)
{
test_tc_links_invalid_target(BPF_TCX_INGRESS);
test_tc_links_invalid_target(BPF_TCX_EGRESS);
@@ -1314,7 +1314,7 @@ static void test_tc_links_prepend_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_prepend(void)
+void test_ns_tc_links_prepend(void)
{
test_tc_links_prepend_target(BPF_TCX_INGRESS);
test_tc_links_prepend_target(BPF_TCX_EGRESS);
@@ -1470,7 +1470,7 @@ static void test_tc_links_append_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_append(void)
+void test_ns_tc_links_append(void)
{
test_tc_links_append_target(BPF_TCX_INGRESS);
test_tc_links_append_target(BPF_TCX_EGRESS);
@@ -1568,7 +1568,7 @@ static void test_tc_links_dev_cleanup_target(int target)
ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
}
-void serial_test_tc_links_dev_cleanup(void)
+void test_ns_tc_links_dev_cleanup(void)
{
test_tc_links_dev_cleanup_target(BPF_TCX_INGRESS);
test_tc_links_dev_cleanup_target(BPF_TCX_EGRESS);
@@ -1672,7 +1672,7 @@ static void test_tc_chain_mixed(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_links_chain_mixed(void)
+void test_ns_tc_links_chain_mixed(void)
{
test_tc_chain_mixed(BPF_TCX_INGRESS);
test_tc_chain_mixed(BPF_TCX_EGRESS);
@@ -1782,7 +1782,7 @@ static void test_tc_links_ingress(int target, bool chain_tc_old,
assert_mprog_count(target, 0);
}
-void serial_test_tc_links_ingress(void)
+void test_ns_tc_links_ingress(void)
{
test_tc_links_ingress(BPF_TCX_INGRESS, true, true);
test_tc_links_ingress(BPF_TCX_INGRESS, true, false);
@@ -1823,7 +1823,7 @@ static int qdisc_replace(int ifindex, const char *kind, bool block)
return err;
}
-void serial_test_tc_links_dev_chain0(void)
+void test_ns_tc_links_dev_chain0(void)
{
int err, ifindex;
@@ -1955,7 +1955,7 @@ static void test_tc_links_dev_mixed(int target)
ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
}
-void serial_test_tc_links_dev_mixed(void)
+void test_ns_tc_links_dev_mixed(void)
{
test_tc_links_dev_mixed(BPF_TCX_INGRESS);
test_tc_links_dev_mixed(BPF_TCX_EGRESS);
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_opts.c b/tools/testing/selftests/bpf/prog_tests/tc_opts.c
index f77f604389aa..dd7a138d8c3d 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_opts.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_opts.c
@@ -10,7 +10,7 @@
#include "test_tc_link.skel.h"
#include "tc_helpers.h"
-void serial_test_tc_opts_basic(void)
+void test_ns_tc_opts_basic(void)
{
LIBBPF_OPTS(bpf_prog_attach_opts, opta);
LIBBPF_OPTS(bpf_prog_detach_opts, optd);
@@ -254,7 +254,7 @@ static void test_tc_opts_before_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_before(void)
+void test_ns_tc_opts_before(void)
{
test_tc_opts_before_target(BPF_TCX_INGRESS);
test_tc_opts_before_target(BPF_TCX_EGRESS);
@@ -445,7 +445,7 @@ static void test_tc_opts_after_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_after(void)
+void test_ns_tc_opts_after(void)
{
test_tc_opts_after_target(BPF_TCX_INGRESS);
test_tc_opts_after_target(BPF_TCX_EGRESS);
@@ -554,7 +554,7 @@ static void test_tc_opts_revision_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_revision(void)
+void test_ns_tc_opts_revision(void)
{
test_tc_opts_revision_target(BPF_TCX_INGRESS);
test_tc_opts_revision_target(BPF_TCX_EGRESS);
@@ -655,7 +655,7 @@ static void test_tc_chain_classic(int target, bool chain_tc_old)
assert_mprog_count(target, 0);
}
-void serial_test_tc_opts_chain_classic(void)
+void test_ns_tc_opts_chain_classic(void)
{
test_tc_chain_classic(BPF_TCX_INGRESS, false);
test_tc_chain_classic(BPF_TCX_EGRESS, false);
@@ -864,7 +864,7 @@ static void test_tc_opts_replace_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_replace(void)
+void test_ns_tc_opts_replace(void)
{
test_tc_opts_replace_target(BPF_TCX_INGRESS);
test_tc_opts_replace_target(BPF_TCX_EGRESS);
@@ -1017,7 +1017,7 @@ static void test_tc_opts_invalid_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_invalid(void)
+void test_ns_tc_opts_invalid(void)
{
test_tc_opts_invalid_target(BPF_TCX_INGRESS);
test_tc_opts_invalid_target(BPF_TCX_EGRESS);
@@ -1157,7 +1157,7 @@ static void test_tc_opts_prepend_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_prepend(void)
+void test_ns_tc_opts_prepend(void)
{
test_tc_opts_prepend_target(BPF_TCX_INGRESS);
test_tc_opts_prepend_target(BPF_TCX_EGRESS);
@@ -1297,7 +1297,7 @@ static void test_tc_opts_append_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_append(void)
+void test_ns_tc_opts_append(void)
{
test_tc_opts_append_target(BPF_TCX_INGRESS);
test_tc_opts_append_target(BPF_TCX_EGRESS);
@@ -1387,7 +1387,7 @@ static void test_tc_opts_dev_cleanup_target(int target)
ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
}
-void serial_test_tc_opts_dev_cleanup(void)
+void test_ns_tc_opts_dev_cleanup(void)
{
test_tc_opts_dev_cleanup_target(BPF_TCX_INGRESS);
test_tc_opts_dev_cleanup_target(BPF_TCX_EGRESS);
@@ -1563,7 +1563,7 @@ static void test_tc_opts_mixed_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_opts_mixed(void)
+void test_ns_tc_opts_mixed(void)
{
test_tc_opts_mixed_target(BPF_TCX_INGRESS);
test_tc_opts_mixed_target(BPF_TCX_EGRESS);
@@ -1642,7 +1642,7 @@ static void test_tc_opts_demixed_target(int target)
assert_mprog_count(target, 0);
}
-void serial_test_tc_opts_demixed(void)
+void test_ns_tc_opts_demixed(void)
{
test_tc_opts_demixed_target(BPF_TCX_INGRESS);
test_tc_opts_demixed_target(BPF_TCX_EGRESS);
@@ -1813,7 +1813,7 @@ static void test_tc_opts_detach_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_detach(void)
+void test_ns_tc_opts_detach(void)
{
test_tc_opts_detach_target(BPF_TCX_INGRESS);
test_tc_opts_detach_target(BPF_TCX_EGRESS);
@@ -2020,7 +2020,7 @@ static void test_tc_opts_detach_before_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_detach_before(void)
+void test_ns_tc_opts_detach_before(void)
{
test_tc_opts_detach_before_target(BPF_TCX_INGRESS);
test_tc_opts_detach_before_target(BPF_TCX_EGRESS);
@@ -2236,7 +2236,7 @@ static void test_tc_opts_detach_after_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_detach_after(void)
+void test_ns_tc_opts_detach_after(void)
{
test_tc_opts_detach_after_target(BPF_TCX_INGRESS);
test_tc_opts_detach_after_target(BPF_TCX_EGRESS);
@@ -2265,7 +2265,7 @@ static void test_tc_opts_delete_empty(int target, bool chain_tc_old)
assert_mprog_count(target, 0);
}
-void serial_test_tc_opts_delete_empty(void)
+void test_ns_tc_opts_delete_empty(void)
{
test_tc_opts_delete_empty(BPF_TCX_INGRESS, false);
test_tc_opts_delete_empty(BPF_TCX_EGRESS, false);
@@ -2372,7 +2372,7 @@ static void test_tc_chain_mixed(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_chain_mixed(void)
+void test_ns_tc_opts_chain_mixed(void)
{
test_tc_chain_mixed(BPF_TCX_INGRESS);
test_tc_chain_mixed(BPF_TCX_EGRESS);
@@ -2446,7 +2446,7 @@ static void test_tc_opts_max_target(int target, int flags, bool relative)
ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
}
-void serial_test_tc_opts_max(void)
+void test_ns_tc_opts_max(void)
{
test_tc_opts_max_target(BPF_TCX_INGRESS, 0, false);
test_tc_opts_max_target(BPF_TCX_EGRESS, 0, false);
@@ -2748,7 +2748,7 @@ static void test_tc_opts_query_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_query(void)
+void test_ns_tc_opts_query(void)
{
test_tc_opts_query_target(BPF_TCX_INGRESS);
test_tc_opts_query_target(BPF_TCX_EGRESS);
@@ -2807,7 +2807,7 @@ static void test_tc_opts_query_attach_target(int target)
test_tc_link__destroy(skel);
}
-void serial_test_tc_opts_query_attach(void)
+void test_ns_tc_opts_query_attach(void)
{
test_tc_opts_query_attach_target(BPF_TCX_INGRESS);
test_tc_opts_query_attach_target(BPF_TCX_EGRESS);
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH stable 6.12 4/5] selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
` (2 preceding siblings ...)
2026-02-24 7:38 ` [PATCH stable 6.12 3/5] selftests/bpf: tc_links/tc_opts: Unserialize tests Shung-Hsi Yu
@ 2026-02-24 7:38 ` Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 5/5] selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set Shung-Hsi Yu
2026-02-24 7:53 ` [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Harshit Mogalapalli
5 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable
Cc: Ricardo B. Marlière, Shung-Hsi Yu,
Bastien Curutchet (eBPF Foundation), Alexei Starovoitov
From: "Bastien Curutchet (eBPF Foundation)" <bastien.curutchet@bootlin.com>
commit 157feaaf18cec6a6eeb71dba334e214834a21030 upstream.
Two subtests use the test_in_netns() function to run the test in a
dedicated network namespace. This can now be done directly through the
test_progs framework with a test name starting with 'ns_'.
Replace the use of test_in_netns() by test_ns_* calls.
Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Link: https://lore.kernel.org/r/20250219-b4-tc_links-v2-4-14504db136b7@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 6cc73f35406c ("selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../bpf/prog_tests/ns_current_pid_tgid.c | 47 +++++++------------
1 file changed, 17 insertions(+), 30 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
index 78020ece6a29..99c953f2be21 100644
--- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
+++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
@@ -200,25 +200,6 @@ static void test_ns_current_pid_tgid_new_ns(int (*fn)(void *), void *arg)
return;
}
-static void test_in_netns(int (*fn)(void *), void *arg)
-{
- struct nstoken *nstoken = NULL;
-
- SYS(cleanup, "ip netns add ns_current_pid_tgid");
- SYS(cleanup, "ip -net ns_current_pid_tgid link set dev lo up");
-
- nstoken = open_netns("ns_current_pid_tgid");
- if (!ASSERT_OK_PTR(nstoken, "open_netns"))
- goto cleanup;
-
- test_ns_current_pid_tgid_new_ns(fn, arg);
-
-cleanup:
- if (nstoken)
- close_netns(nstoken);
- SYS_NOFAIL("ip netns del ns_current_pid_tgid");
-}
-
/* TODO: use a different tracepoint */
void serial_test_current_pid_tgid(void)
{
@@ -226,15 +207,21 @@ void serial_test_current_pid_tgid(void)
test_current_pid_tgid_tp(NULL);
if (test__start_subtest("new_ns_tp"))
test_ns_current_pid_tgid_new_ns(test_current_pid_tgid_tp, NULL);
- if (test__start_subtest("new_ns_cgrp")) {
- int cgroup_fd = -1;
-
- cgroup_fd = test__join_cgroup("/sock_addr");
- if (ASSERT_GE(cgroup_fd, 0, "join_cgroup")) {
- test_in_netns(test_current_pid_tgid_cgrp, &cgroup_fd);
- close(cgroup_fd);
- }
- }
- if (test__start_subtest("new_ns_sk_msg"))
- test_in_netns(test_current_pid_tgid_sk_msg, NULL);
}
+
+void test_ns_current_pid_tgid_cgrp(void)
+{
+ int cgroup_fd = test__join_cgroup("/sock_addr");
+
+ if (ASSERT_OK_FD(cgroup_fd, "join_cgroup")) {
+ test_ns_current_pid_tgid_new_ns(test_current_pid_tgid_cgrp, &cgroup_fd);
+ close(cgroup_fd);
+ }
+}
+
+void test_ns_current_pid_tgid_sk_msg(void)
+{
+ test_ns_current_pid_tgid_new_ns(test_current_pid_tgid_sk_msg, NULL);
+}
+
+
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH stable 6.12 5/5] selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
` (3 preceding siblings ...)
2026-02-24 7:38 ` [PATCH stable 6.12 4/5] selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature Shung-Hsi Yu
@ 2026-02-24 7:38 ` Shung-Hsi Yu
2026-02-24 7:53 ` [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Harshit Mogalapalli
5 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-24 7:38 UTC (permalink / raw)
To: stable
Cc: Ricardo B. Marlière, Shung-Hsi Yu, Martin KaFai Lau,
Alexei Starovoitov
From: Martin KaFai Lau <martin.lau@kernel.org>
commit 6cc73f35406cae1f053e984e8de40e6dc9681446 upstream.
Add a test to check that bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) is
rejected (-EINVAL) if skb->transport_header is not set. The test
needs to lower the MTU of the loopback device. Thus, take this
opportunity to run the test in a netns by adding "ns_" to the test
name. The "serial_" prefix can then be removed.
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20251112232331.1566074-2-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
.../selftests/bpf/prog_tests/check_mtu.c | 23 ++++++++++++++++++-
.../selftests/bpf/progs/test_check_mtu.c | 12 ++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c
index 2a9a30650350..65b4512967e7 100644
--- a/tools/testing/selftests/bpf/prog_tests/check_mtu.c
+++ b/tools/testing/selftests/bpf/prog_tests/check_mtu.c
@@ -153,6 +153,26 @@ static void test_check_mtu_run_tc(struct test_check_mtu *skel,
ASSERT_EQ(mtu_result, mtu_expect, "MTU-compare-user");
}
+static void test_chk_segs_flag(struct test_check_mtu *skel, __u32 mtu)
+{
+ int err, prog_fd = bpf_program__fd(skel->progs.tc_chk_segs_flag);
+ struct __sk_buff skb = {
+ .gso_size = 10,
+ };
+ LIBBPF_OPTS(bpf_test_run_opts, topts,
+ .data_in = &pkt_v4,
+ .data_size_in = sizeof(pkt_v4),
+ .ctx_in = &skb,
+ .ctx_size_in = sizeof(skb),
+ );
+
+ /* Lower the mtu to test the BPF_MTU_CHK_SEGS */
+ SYS_NOFAIL("ip link set dev lo mtu 10");
+ err = bpf_prog_test_run_opts(prog_fd, &topts);
+ SYS_NOFAIL("ip link set dev lo mtu %u", mtu);
+ ASSERT_OK(err, "test_run");
+ ASSERT_EQ(topts.retval, BPF_OK, "retval");
+}
static void test_check_mtu_tc(__u32 mtu, __u32 ifindex)
{
@@ -177,11 +197,12 @@ static void test_check_mtu_tc(__u32 mtu, __u32 ifindex)
test_check_mtu_run_tc(skel, skel->progs.tc_minus_delta, mtu);
test_check_mtu_run_tc(skel, skel->progs.tc_input_len, mtu);
test_check_mtu_run_tc(skel, skel->progs.tc_input_len_exceed, mtu);
+ test_chk_segs_flag(skel, mtu);
cleanup:
test_check_mtu__destroy(skel);
}
-void serial_test_check_mtu(void)
+void test_ns_check_mtu(void)
{
int mtu_lo;
diff --git a/tools/testing/selftests/bpf/progs/test_check_mtu.c b/tools/testing/selftests/bpf/progs/test_check_mtu.c
index 2ec1de11a3ae..7b6b2b342c1d 100644
--- a/tools/testing/selftests/bpf/progs/test_check_mtu.c
+++ b/tools/testing/selftests/bpf/progs/test_check_mtu.c
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <errno.h>
char _license[] SEC("license") = "GPL";
@@ -288,3 +289,14 @@ int tc_input_len_exceed(struct __sk_buff *ctx)
global_bpf_mtu_xdp = mtu_len;
return retval;
}
+
+SEC("tc")
+int tc_chk_segs_flag(struct __sk_buff *ctx)
+{
+ __u32 mtu_len = 0;
+ int err;
+
+ err = bpf_check_mtu(ctx, GLOBAL_USER_IFINDEX, &mtu_len, 0, BPF_MTU_CHK_SEGS);
+
+ return err == -EINVAL ? BPF_OK : BPF_DROP;
+}
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
` (4 preceding siblings ...)
2026-02-24 7:38 ` [PATCH stable 6.12 5/5] selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set Shung-Hsi Yu
@ 2026-02-24 7:53 ` Harshit Mogalapalli
2026-02-24 12:18 ` Ricardo B. Marlière
5 siblings, 1 reply; 11+ messages in thread
From: Harshit Mogalapalli @ 2026-02-24 7:53 UTC (permalink / raw)
To: Shung-Hsi Yu, stable; +Cc: Ricardo B. Marlière
Hi,
On 24/02/26 13:08, Shung-Hsi Yu wrote:
> This patchset backport the corresponding BPF selftests for commit
> d946f3c98328 ("bpf: Check skb->transport_header is set in
> bpf_skb_check_mtu"), which has already been included since 6.12.63.
>
> The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
> bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
> additionally depends on network namespace support for BPF selftests
> added by Bastien, otherwise the MTU in root networking namespace will be
> set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
> Marlière for figuring out the dependency.
>
Note:
I have recently learnt that ideally we are supposed to run upstream
latest kselftests on stable kernels as well. If a feature is not
supported the kselftests are meant to be skipped.
https://lore.kernel.org/all/a45eaddb-9e17-4e82-8a78-a1d1f6e3d735@linuxfoundation.org/
Thanks,
Harshit
> Bastien Curutchet (eBPF Foundation) (4):
> selftests/bpf: ns_current_pid_tgid: Rename the test function
> selftests/bpf: Optionally open a dedicated namespace to run test in it
> selftests/bpf: tc_links/tc_opts: Unserialize tests
> selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature
>
> Martin KaFai Lau (1):
> selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when
> transport_header is not set
>
> .../selftests/bpf/prog_tests/check_mtu.c | 23 ++++++++-
> .../bpf/prog_tests/ns_current_pid_tgid.c | 49 +++++++------------
> .../selftests/bpf/prog_tests/tc_links.c | 28 +++++------
> .../selftests/bpf/prog_tests/tc_opts.c | 40 +++++++--------
> .../selftests/bpf/progs/test_check_mtu.c | 12 +++++
> tools/testing/selftests/bpf/test_progs.c | 12 +++++
> 6 files changed, 98 insertions(+), 66 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"
2026-02-24 7:53 ` [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Harshit Mogalapalli
@ 2026-02-24 12:18 ` Ricardo B. Marlière
2026-02-25 2:35 ` Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"') Shung-Hsi Yu
0 siblings, 1 reply; 11+ messages in thread
From: Ricardo B. Marlière @ 2026-02-24 12:18 UTC (permalink / raw)
To: Harshit Mogalapalli, Shung-Hsi Yu, stable; +Cc: Ricardo B. Marlière
On Tue Feb 24, 2026 at 4:53 AM -03, Harshit Mogalapalli wrote:
> Hi,
>
> On 24/02/26 13:08, Shung-Hsi Yu wrote:
>> This patchset backport the corresponding BPF selftests for commit
>> d946f3c98328 ("bpf: Check skb->transport_header is set in
>> bpf_skb_check_mtu"), which has already been included since 6.12.63.
>>
>> The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
>> bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
>> additionally depends on network namespace support for BPF selftests
>> added by Bastien, otherwise the MTU in root networking namespace will be
>> set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
>> Marlière for figuring out the dependency.
>>
>
> Note:
> I have recently learnt that ideally we are supposed to run upstream
> latest kselftests on stable kernels as well. If a feature is not
> supported the kselftests are meant to be skipped.
That is not true for BPF, from my (limited) experience.
>
> https://lore.kernel.org/all/a45eaddb-9e17-4e82-8a78-a1d1f6e3d735@linuxfoundation.org/
>
> Thanks,
> Harshit
>> Bastien Curutchet (eBPF Foundation) (4):
>> selftests/bpf: ns_current_pid_tgid: Rename the test function
>> selftests/bpf: Optionally open a dedicated namespace to run test in it
>> selftests/bpf: tc_links/tc_opts: Unserialize tests
>> selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature
>>
>> Martin KaFai Lau (1):
>> selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when
>> transport_header is not set
>>
>> .../selftests/bpf/prog_tests/check_mtu.c | 23 ++++++++-
>> .../bpf/prog_tests/ns_current_pid_tgid.c | 49 +++++++------------
>> .../selftests/bpf/prog_tests/tc_links.c | 28 +++++------
>> .../selftests/bpf/prog_tests/tc_opts.c | 40 +++++++--------
>> .../selftests/bpf/progs/test_check_mtu.c | 12 +++++
>> tools/testing/selftests/bpf/test_progs.c | 12 +++++
>> 6 files changed, 98 insertions(+), 66 deletions(-)
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"')
2026-02-24 12:18 ` Ricardo B. Marlière
@ 2026-02-25 2:35 ` Shung-Hsi Yu
2026-02-25 14:32 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-25 2:35 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: Ricardo B. Marlière, stable, Shuah Khan, Greg KH,
linux-kselftest, Daniel Borkmann, Alexei Starovoitov,
Andrii Nakryiko, bpf
Cc BPF mailing list and maintainers. Plus other in the referenced
thread.
Hi Harshit,
On Tue, Feb 24, 2026 at 09:18:04AM -0300, Ricardo B. Marlière wrote:
> On Tue Feb 24, 2026 at 4:53 AM -03, Harshit Mogalapalli wrote:
> > On 24/02/26 13:08, Shung-Hsi Yu wrote:
> >> This patchset backport the corresponding BPF selftests for commit
> >> d946f3c98328 ("bpf: Check skb->transport_header is set in
> >> bpf_skb_check_mtu"), which has already been included since 6.12.63.
> >>
> >> The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
> >> bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
> >> additionally depends on network namespace support for BPF selftests
> >> added by Bastien, otherwise the MTU in root networking namespace will be
> >> set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
> >> Marlière for figuring out the dependency.
> >
> > Note:
> > I have recently learnt that ideally we are supposed to run upstream
> > latest kselftests on stable kernels as well. If a feature is not
> > supported the kselftests are meant to be skipped.
Thanks you for the bringing this up! This was also mentioned by Daniel
(Borkmann), but my experience aligns with Ricardo's.
> That is not true for BPF, from my (limited) experience.
I do want running latest BPF selftests to work on stable thought, made
some half-hearted attempts last April on trying bpf-next's BPF selftests
(during 6.15 phase) run on stable/linux-6.14.y, but wasn't able to get
pass the building phase.
As far as I remember I ran into issue building bpf_testmod.ko (kernel
module) of bpf-next against 6.14, and other similar issues related data
structure or API changes. Pretty much the same set of problems we get
when trying to build any driver in the latest kernel against stable
kernels.
Maybe it can work if BPF selftests that does not depends on
bpf_testmod.ko, and build failures of BPF programs are simply ignored
(not sure how feasible that is, probably would make Makefile much
complicated), so for now I'm sticking with backporting BPF selftests to
stable kernels.
Thanks,
Shung-Hsi
> > https://lore.kernel.org/all/a45eaddb-9e17-4e82-8a78-a1d1f6e3d735@linuxfoundation.org/
> >
> > Thanks,
> > Harshit
[...]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"')
2026-02-25 2:35 ` Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"') Shung-Hsi Yu
@ 2026-02-25 14:32 ` Greg KH
2026-02-26 7:33 ` Shung-Hsi Yu
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2026-02-25 14:32 UTC (permalink / raw)
To: Shung-Hsi Yu
Cc: Harshit Mogalapalli, Ricardo B. Marlière, stable, Shuah Khan,
linux-kselftest, Daniel Borkmann, Alexei Starovoitov,
Andrii Nakryiko, bpf
On Wed, Feb 25, 2026 at 10:35:06AM +0800, Shung-Hsi Yu wrote:
> Cc BPF mailing list and maintainers. Plus other in the referenced
> thread.
>
> Hi Harshit,
>
> On Tue, Feb 24, 2026 at 09:18:04AM -0300, Ricardo B. Marlière wrote:
> > On Tue Feb 24, 2026 at 4:53 AM -03, Harshit Mogalapalli wrote:
> > > On 24/02/26 13:08, Shung-Hsi Yu wrote:
> > >> This patchset backport the corresponding BPF selftests for commit
> > >> d946f3c98328 ("bpf: Check skb->transport_header is set in
> > >> bpf_skb_check_mtu"), which has already been included since 6.12.63.
> > >>
> > >> The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
> > >> bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
> > >> additionally depends on network namespace support for BPF selftests
> > >> added by Bastien, otherwise the MTU in root networking namespace will be
> > >> set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
> > >> Marlière for figuring out the dependency.
> > >
> > > Note:
> > > I have recently learnt that ideally we are supposed to run upstream
> > > latest kselftests on stable kernels as well. If a feature is not
> > > supported the kselftests are meant to be skipped.
>
> Thanks you for the bringing this up! This was also mentioned by Daniel
> (Borkmann), but my experience aligns with Ricardo's.
>
> > That is not true for BPF, from my (limited) experience.
>
> I do want running latest BPF selftests to work on stable thought, made
> some half-hearted attempts last April on trying bpf-next's BPF selftests
> (during 6.15 phase) run on stable/linux-6.14.y, but wasn't able to get
> pass the building phase.
>
> As far as I remember I ran into issue building bpf_testmod.ko (kernel
> module) of bpf-next against 6.14, and other similar issues related data
> structure or API changes. Pretty much the same set of problems we get
> when trying to build any driver in the latest kernel against stable
> kernels.
>
> Maybe it can work if BPF selftests that does not depends on
> bpf_testmod.ko, and build failures of BPF programs are simply ignored
> (not sure how feasible that is, probably would make Makefile much
> complicated), so for now I'm sticking with backporting BPF selftests to
> stable kernels.
If a kernel test module is involved, then yes, you are right, those
changes do need to be backported as mix/match of kernel modules to other
trees is not something that we support.
We only want this to be the rule for when we have purely userspace test
cases/code.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"')
2026-02-25 14:32 ` Greg KH
@ 2026-02-26 7:33 ` Shung-Hsi Yu
0 siblings, 0 replies; 11+ messages in thread
From: Shung-Hsi Yu @ 2026-02-26 7:33 UTC (permalink / raw)
To: Greg KH, Harshit Mogalapalli
Cc: Ricardo B. Marlière, stable, Shuah Khan, linux-kselftest,
Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, bpf
On Wed, Feb 25, 2026 at 06:32:40AM -0800, Greg KH wrote:
> On Wed, Feb 25, 2026 at 10:35:06AM +0800, Shung-Hsi Yu wrote:
> > Cc BPF mailing list and maintainers. Plus other in the referenced
> > thread.
> >
> > Hi Harshit,
> >
> > On Tue, Feb 24, 2026 at 09:18:04AM -0300, Ricardo B. Marlière wrote:
> > > On Tue Feb 24, 2026 at 4:53 AM -03, Harshit Mogalapalli wrote:
> > > > On 24/02/26 13:08, Shung-Hsi Yu wrote:
> > > >> This patchset backport the corresponding BPF selftests for commit
> > > >> d946f3c98328 ("bpf: Check skb->transport_header is set in
> > > >> bpf_skb_check_mtu"), which has already been included since 6.12.63.
> > > >>
> > > >> The BPF selftest added in commit 6cc73f35406c ("selftests/bpf: Test
> > > >> bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set")
> > > >> additionally depends on network namespace support for BPF selftests
> > > >> added by Bastien, otherwise the MTU in root networking namespace will be
> > > >> set to 10, causing other BPF selftests to fail. Credit goes to Ricardo
> > > >> Marlière for figuring out the dependency.
> > > >
> > > > Note:
> > > > I have recently learnt that ideally we are supposed to run upstream
> > > > latest kselftests on stable kernels as well. If a feature is not
> > > > supported the kselftests are meant to be skipped.
> >
> > Thanks you for the bringing this up! This was also mentioned by Daniel
> > (Borkmann), but my experience aligns with Ricardo's.
> >
> > > That is not true for BPF, from my (limited) experience.
> >
> > I do want running latest BPF selftests to work on stable thought, made
> > some half-hearted attempts last April on trying bpf-next's BPF selftests
> > (during 6.15 phase) run on stable/linux-6.14.y, but wasn't able to get
> > pass the building phase.
> >
> > As far as I remember I ran into issue building bpf_testmod.ko (kernel
> > module) of bpf-next against 6.14, and other similar issues related data
> > structure or API changes. Pretty much the same set of problems we get
> > when trying to build any driver in the latest kernel against stable
> > kernels.
> >
> > Maybe it can work if BPF selftests that does not depends on
> > bpf_testmod.ko, and build failures of BPF programs are simply ignored
> > (not sure how feasible that is, probably would make Makefile much
> > complicated), so for now I'm sticking with backporting BPF selftests to
> > stable kernels.
>
> If a kernel test module is involved, then yes, you are right, those
> changes do need to be backported as mix/match of kernel modules to other
> trees is not something that we support.
>
> We only want this to be the rule for when we have purely userspace test
> cases/code.
Thanks for the confirmation regarding kernel test module.
For the record most BPF selftests probably doesn't depends on
bpf_testmod.ko, I don't think I have state that clear enough in the
exchange. So with some work running a subset of latest BPF selftest on
stable kernel may be possible, just that I have no idea the effort
required.
Thanks,
Shung-Hsi
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-02-26 7:33 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 7:38 [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 1/5] selftests/bpf: ns_current_pid_tgid: Rename the test function Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 2/5] selftests/bpf: Optionally open a dedicated namespace to run test in it Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 3/5] selftests/bpf: tc_links/tc_opts: Unserialize tests Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 4/5] selftests/bpf: ns_current_pid_tgid: Use test_progs's ns_ feature Shung-Hsi Yu
2026-02-24 7:38 ` [PATCH stable 6.12 5/5] selftests/bpf: Test bpf_skb_check_mtu(BPF_MTU_CHK_SEGS) when transport_header is not set Shung-Hsi Yu
2026-02-24 7:53 ` [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu" Harshit Mogalapalli
2026-02-24 12:18 ` Ricardo B. Marlière
2026-02-25 2:35 ` Latest BPF selftests on stable kernels (was 'Re: [PATCH stable 6.12 0/5] Backport selftest for "bpf: Check skb->transport_header is set in bpf_skb_check_mtu"') Shung-Hsi Yu
2026-02-25 14:32 ` Greg KH
2026-02-26 7:33 ` Shung-Hsi Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox