lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+3lwZChsI0Trok8@Laptop-X1>
Date:   Thu, 16 Feb 2023 16:13:53 +0800
From:   Hangbin Liu <liuhangbin@...il.com>
To:     Matthieu Baerts <matthieu.baerts@...sares.net>
Cc:     Martin KaFai Lau <martin.lau@...ux.dev>, netdev@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        Mykola Lysenko <mykolal@...com>,
        Felix Maurer <fmaurer@...hat.com>,
        Davide Caratti <dcaratti@...hat.com>
Subject: Re: [PATCH bpf] selftests/bpf: enable mptcp before testing

On Wed, Feb 15, 2023 at 10:58:20AM +0100, Matthieu Baerts wrote:
> Hi Hangbin, Martin,
>
> Thank you both for your replies!
> 
> Yes, that would be good to have this test running in a dedicated NS.
> 
> Then mptcp.enabled can be forced using write_sysctl() or SYS("sysctl (...)".
> 

Hi Matt, Martin,

I tried to set make mptcp test in netns, like decap_sanity.c does. But I got
error when delete the netns. e.g.

# ./test_progs -t mptcp
Cannot remove namespace file "/var/run/netns/mptcp_ns": Device or resource busy
#127/1   mptcp/base:OK
#127     mptcp:OK
Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED

Do you have any idea why I can't remove the netns? Here is the draft patch:

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 59f08d6d1d53..5ad10a860994 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -7,6 +7,16 @@
 #include "network_helpers.h"
 #include "mptcp_sock.skel.h"
 
+#define SYS(fmt, ...)						\
+	({							\
+		char cmd[1024];					\
+		snprintf(cmd, sizeof(cmd), fmt, ##__VA_ARGS__);	\
+		if (!ASSERT_OK(system(cmd), cmd))		\
+			goto fail;				\
+	})
+
+#define NS_TEST "mptcp_ns"
+
 #ifndef TCP_CA_NAME_MAX
 #define TCP_CA_NAME_MAX	16
 #endif
@@ -169,6 +179,22 @@ static void test_base(void)
 
 void test_mptcp(void)
 {
+	struct nstoken *nstoken = NULL;
+
+	SYS("ip netns add %s", NS_TEST);
+	SYS("ip -net %s link set dev lo up", NS_TEST);
+
+	nstoken = open_netns(NS_TEST);
+	if (!ASSERT_OK_PTR(nstoken, "open_netns"))
+		goto fail;
+
 	if (test__start_subtest("base"))
 		test_base();
+
+fail:
+	if (nstoken)
+		close_netns(nstoken);
+
+	//system("ip netns del " NS_TEST " >& /dev/null");
+	system("ip netns del " NS_TEST);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ