From: Matthieu Baerts <matttbe@kernel.org>
To: Vastargazing <vebohr@gmail.com>, martineau@kernel.org
Cc: mptcp@lists.linux.dev, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, shuah@kernel.org,
stable@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH] selftests: mptcp: add test for IPv6 subflow SLAB placement
Date: Fri, 1 May 2026 17:45:56 +0200 [thread overview]
Message-ID: <44e564f8-d059-407b-8f5e-a149dd76dea3@kernel.org> (raw)
In-Reply-To: <20260501151454.211598-1-vebohr@gmail.com>
Hi Vastargazing,
(+cc Florian who did a similar review on netfilter ML)
On 01/05/2026 17:14, Vastargazing wrote:
> Add mptcp_v6_initcall.sh to verify that MPTCP IPv6 subflow child
> sockets are allocated from the TCPv6 SLAB cache, not the kmalloc-4k
> fallback.
>
> tcpv6_prot_override must copy tcpv6_prot after proto_register(&tcpv6_prot)
> populates tcpv6_prot.slab. If the copy runs too early, override.slab
> stays NULL (frozen by __ro_after_init) and subflow children fall back
> to kmalloc-4k. This lacks SLAB_TYPESAFE_BY_RCU, allowing lockless
> ehash lookups in __inet_lookup_established to read freed memory.
>
> The test exercises the IPv6 accept path via MPTCP connections between
> two network namespaces, then checks that the TCPv6 slab active object
> count grew. On a fixed kernel, the delta is ~2 * NR_CONNS (one subflow
> per side per connection); on a broken kernel, it stays near zero because
> children land in kmalloc-4k instead.
>
> Topology: two netns connected via veth pair with /64 ULA addresses;
> NR_CONNS parallel short-lived MPTCP connections are established and held
> open long enough to sample /proc/slabinfo. The test skips if
> CONFIG_MPTCP_IPV6 is absent (checked via kallsyms) or /proc/slabinfo is
> unreadable.
>
> Verified on Ubuntu 6.17 kernel predating the fix: TAP "not ok 1 ...
> TCPv6 slab gains MPTCPv6 subflow children" with delta=0. On kernels
> with the fix, delta is well above the threshold of NR_CONNS/2.
Thank you for adding this new test, and for having validated
9b55b253907e ("mptcp: fix slab-use-after-free in
__inet_lookup_established").
(...)
My following review comments are very similar to the ones shared by
Florian for another on the Netfilter ML.
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_v6_initcall.sh b/tools/testing/selftests/net/mptcp/mptcp_v6_initcall.sh
> new file mode 100644
This should say '755', else you get
# Warning: file mptcp_v6_initcall.sh is not executable
(Plus our CI will not validate that test.)
Me too, I'm not sure whether we should add regression tests for
regression tests sake. Else we'll also quickly accumulate thousands of
such scripts and test run time will explode. Globally, we prefer adding
a new subtest instead of a full test.
Here, you are validating an issue in the init code, that is very
unlikely to change. If a test was needed during the submission of the
original fix, I would have suggested adding a quick test in our
packetdrill repo instead:
https://github.com/multipath-tcp/packetdrill
An existing packetdrill test could be modified to check the slabs in v4
and v6, but I'm still not convinced it is worth it.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2026-05-01 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 15:14 [PATCH] selftests: mptcp: add test for IPv6 subflow SLAB placement Vastargazing
2026-05-01 15:45 ` Matthieu Baerts [this message]
2026-05-01 17:01 ` Vastargazing
2026-05-04 17:44 ` Matthieu Baerts
-- strict thread matches above, loose matches on Subject: below --
2026-05-01 15:14 Vastargazing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44e564f8-d059-407b-8f5e-a149dd76dea3@kernel.org \
--to=matttbe@kernel.org \
--cc=fw@strlen.de \
--cc=linux-kselftest@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vebohr@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox