Re: [PATCH net 2/2] selftests/net: add SO_RESERVE_MEM test
flat view
From: Matthieu Baerts <matttbe@kernel.org>
Date: 2026-09-25 13:49:55
Hi Eric, Thank you for the new test. On 25/09/2026 14:49, netdev-bot+sashiko@kernel.org wrote:
Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider.
(...)
quoted
+static void check_non_tcp_rejected(struct __test_metadata *_metadata, + int domain, int type, int protocol, + int val) +{ + int fd = socket(domain, type, protocol); + + if (fd < 0) { + EXPECT_TRUE(errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT); + return; + }[Severity: Medium] Should ENOPROTOOPT be accepted here as well? MPTCP can be built in but disabled with net.mptcp.enabled=0. In that case socket creation fails here: net/mptcp/protocol.c:mptcp_init_sock() { ... if (!mptcp_is_enabled(net)) return -ENOPROTOOPT; ... } inet_create() passes that error back to userspace. As a result, socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP) in non_tcp_rejected fails with ENOPROTOOPT, and the EXPECT_TRUE fails the test. The test doesn't unshare the network namespace, so it sees the host's sysctl. Any other environment-specific socket() errno also becomes an EXPECT failure rather than a skip.
Typically, we try to run the tests in a dedicated netns to avoid such issues. (We also force net.mptcp.enabled=1 because it is still disabled on RHEL, which is really a shame... but I don't think we really need to support that here in the selftests.) At the end, I don't think we need to care about all possible cases, but using a netns is probably a good idea, at least not to "poison" other tests. (If that's easy to put in place.) Cheers, Matt -- Sponsored by the NGI0 Core fund.