From: Jakub Sitnicki <jakub@cloudflare.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Neal Cardwell <ncardwell@google.com>,
Willem de Bruijn <willemb@google.com>,
David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org, Kyle Zeng <kylebot@openai.com>,
Michal Luczaj <mhal@rbox.co>, Hyunwoo Kim <imv4bel@gmail.com>
Subject: Re: [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2.
Date: Fri, 04 Sep 2026 13:32:53 +0200 [thread overview]
Message-ID: <87fqzp2qvu.fsf@cloudflare.com> (raw)
In-Reply-To: <20260904033543.2635540-2-kuniyu@google.com> (Kuniyuki Iwashima's message of "Fri, 4 Sep 2026 03:35:28 +0000")
On Fri, Sep 04, 2026 at 03:35 AM GMT, Kuniyuki Iwashima wrote:
> The following state transitions have long been a playground for
> syzbot, and recently AI joined in, reporting a lot more bugs.
>
> * listen() + shutdown() + connect()
> * connect() + connect(AF_UNSPEC) + listen()
>
> All the fix attempts would add more code to the fast path, which
> is not worth it.
>
> Instead of playing whack-a-mole with these edge-case bugs,
> let's disallow these transitions.
>
> Note that unhashed_state is placed in the 4-byte hole after
> icsk_pmtu_cookie.
>
> $ pahole -C inet_connection_sock vmlinux
> struct inet_connection_sock {
> ...
> __u32 icsk_pmtu_cookie; /* 1208 4 */
> unsigned char unhashed_state; /* 1212 1 */
>
> /* XXX 3 bytes hole, try to pack */
>
> Reported-by: Kyle Zeng <kylebot@openai.com>
> Closes: https://lore.kernel.org/netdev/20260731140512.566464-1-david.lee@trailofbits.com/
> Reported-by: Michal Luczaj <mhal@rbox.co>
> Closes: https://lore.kernel.org/netdev/20260803-sockmap-lookup-tcp-leak-v2-0-306e025bfe66@rbox.co/
> Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
> Closes: https://lore.kernel.org/netdev/20260824033331.1084971-1-imv4bel@gmail.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---
> include/net/inet_connection_sock.h | 1 +
> net/ipv4/inet_connection_sock.c | 1 +
> net/ipv4/inet_hashtables.c | 11 +++++++++++
> 3 files changed, 13 insertions(+)
>
> diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
> index 433c2df23076..903499581db7 100644
> --- a/include/net/inet_connection_sock.h
> +++ b/include/net/inet_connection_sock.h
> @@ -94,6 +94,7 @@ struct inet_connection_sock {
> u32 icsk_rto_max;
> __u32 icsk_delack_max;
> __u32 icsk_pmtu_cookie;
> + unsigned char unhashed_state;
> const struct tcp_congestion_ops *icsk_ca_ops;
> const struct inet_connection_sock_af_ops *icsk_af_ops;
> const struct tcp_ulp_ops *icsk_ulp_ops;
Glad we went in that direction in the end. Makes like easier.
Nit: Could be a flag, like CAN_LISTEN or CAN_CONNECT?
Either INET_FLAGS_* or maybe we need ICSK_FLAGS_*?
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
next prev parent reply other threads:[~2026-09-04 11:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 3:35 [PATCH v1 net-next 0/2] net: Disallow buggy TCP transitions and IPV6_ADDRFORM Kuniyuki Iwashima
2026-09-04 3:35 ` [PATCH v1 net-next 1/2] tcp: Do not allow buggy transitions between ehash and lhash2 Kuniyuki Iwashima
2026-09-04 11:32 ` Jakub Sitnicki [this message]
2026-09-04 3:35 ` [PATCH v1 net-next 2/2] ipv6: Remove IPV6_ADDRFORM Kuniyuki Iwashima
2026-09-04 9:10 ` Paolo Abeni
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=87fqzp2qvu.fsf@cloudflare.com \
--to=jakub@cloudflare.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=imv4bel@gmail.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=kylebot@openai.com \
--cc=mhal@rbox.co \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.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