From: netdev-bot+sashiko@kernel.org
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, quic@lists.linux.dev,
davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, metze@samba.org,
mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
dreibh@simula.no, linux-cifs@vger.kernel.org, pc@manguebit.org,
linkinjeon@kernel.org, tom@talpey.com,
kernel-tls-handshake@lists.linux.dev, chuck.lever@oracle.com,
jlayton@kernel.org, steved@redhat.com, hare@suse.de,
aahringo@redhat.com, dhowells@redhat.com, matttbe@kernel.org,
mail@johnericson.me, xiyou.wangcong@gmail.com,
alibuda@linux.alibaba.com, jbaron@akamai.com,
illiliti@protonmail.com, sd@queasysnail.net,
marcelo.leitner@gmail.com, daniel@haxx.se,
andrew.gospodarek@broadcom.com, mef@scarletmail.rutgers.edu,
paul@jakma.org
Subject: Re: [PATCH net-next v15 03/15] quic: provide common utilities and data structures
Date: Tue, 15 Sep 2026 19:50:23 +0000 [thread overview]
Message-ID: <178950182306.22033.14152384539754204368@kernel.org> (raw)
In-Reply-To: <1cf83a4eb178197cd842e34468f4e357f42b9c28.1789393775.git.lucien.xin@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 1 · Low: 0
- [Medium] Weak hash seeding in the new QUIC hash helpers:
`quic_sock_hash()` (net/quic/common.c:40-53) reduces IPv6 addresses to…
--
quic: provide common utilities and data structures
This patch adds net/quic/common.c and net/quic/common.h with the QUIC
packet header types, connection ID and address helpers, the socket and
connection ID hash tables, and the varint/transport-parameter encoding
helpers. quic_init() now initializes and tears down the hash tables.
One question below about the hash helpers.
> diff --git a/net/quic/common.c b/net/quic/common.c
> new file mode 100644
> index 0000000000000..51d71b6733c7d
> --- /dev/null
> +++ b/net/quic/common.c
> @@ -0,0 +1,565 @@
[ ... ]
> +u32 quic_sock_hash(struct net *net, union quic_addr *s, union quic_addr *d)
> +{
> + u32 ports = ((__force u32)s->v4.sin_port) << 16 |
> + (__force u32)d->v4.sin_port;
> + u32 saddr = (s->sa.sa_family == AF_INET6) ?
> + jhash(&s->v6.sin6_addr, 16, 0) :
> + (__force u32)s->v4.sin_addr.s_addr;
> + u32 daddr = (d->sa.sa_family == AF_INET6) ?
> + jhash(&d->v6.sin6_addr, 16, 0) :
> + (__force u32)d->v4.sin_addr.s_addr;
> + u32 hash = jhash_3words(saddr, daddr, ports, net_hash_mix(net));
> +
> + return hash & (quic_sock_hash_size() - 1);
> +}
[Severity: Medium]
Should the inner IPv6 fold in quic_sock_hash() be seeded?
The per-netns secret is only mixed in the outer jhash_3words() call, while
the 128-bit address is first reduced to 32 bits with jhash(..., 0). Since
jhash_3words(a, b, c, initval) is a pure function of its inputs, two peer
addresses whose unseeded 32-bit fold is equal produce identical (saddr,
daddr, ports) triples and therefore the same bucket for every value of
net_hash_mix(net).
Does that let a peer controlling an IPv6 prefix pick colliding source
addresses offline, without knowing the secret, and collapse many
connections into one chain of quic_hashinfo.chash (capped at 16K buckets)
that the per-packet lookup then walks?
Compare with sctp_hashfn() in net/sctp/input.c, which the commit message
cites as the model and which passes the seed into the inner fold:
if (paddr->sa.sa_family == AF_INET6)
addr = jhash(&paddr->v6.sin6_addr, 16, seed);
else
addr = (__force __u32)paddr->v4.sin_addr.s_addr;
return jhash_3words(addr, ((__force __u32)paddr->v4.sin_port) << 16 |
(__force __u32)lport, net_hash_mix(net), seed);
Would jhash(&s->v6.sin6_addr, 16, net_hash_mix(net)) here be equivalent in
cost?
[ ... ]
> +struct quic_shash_head *quic_source_conn_id_head(struct net *net, u8 *scid,
> + u32 len)
> +{
> + u32 hash = jhash_1word(jhash(scid, len, 0), net_hash_mix(net));
> + struct quic_shash_table *ht = &quic_hashinfo.shash;
> +
> + return &ht->hash[hash & (ht->size - 1)];
> +}
[Severity: Medium]
Same pattern here: the connection ID bytes are folded with jhash(scid, len,
0) before the secret is applied, so any two connection IDs colliding in
that unseeded fold share a bucket for any secret. Would passing
net_hash_mix(net) as the initval of the inner jhash() be preferable?
Note the connection IDs inserted in this series come from
quic_conn_id_generate() using get_random_bytes(), so the practical exposure
is smaller than for the connection socket table.
> +u32 quic_addr_hash(struct net *net, union quic_addr *a)
> +{
> + u32 addr = (a->sa.sa_family == AF_INET6) ?
> + jhash(&a->v6.sin6_addr, 16, 0) :
> + (__force u32)a->v4.sin_addr.s_addr;
> +
> + return jhash_2words(addr, (__force u32)a->v4.sin_port,
> + net_hash_mix(net));
> +}
[Severity: Medium]
And the same unseeded sin6_addr fold appears in quic_addr_hash(), so
address-keyed hashing inherits the same property. Should all three helpers
be updated together?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1789393775.git.lucien.xin%40gmail.com
next prev reply other threads:[~2026-09-15 19:50 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 13:49 [PATCH net-next v15 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 03/15] quic: provide common utilities and data structures Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko [this message]
2026-09-16 15:18 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 04/15] quic: provide family ops for address and protocol Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 06/15] quic: add stream management Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 15:21 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 07/15] quic: add connection id management Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 08/15] quic: add path management Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 15:43 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 09/15] quic: add congestion control Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 15:48 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 10/15] quic: add packet number space Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 11/15] quic: add crypto key derivation and installation Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 15:51 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 16:01 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 13/15] quic: add timer management Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 14/15] quic: add packet builder base Xin Long
2026-09-15 19:50 ` netdev-bot+sashiko
2026-09-16 16:20 ` Xin Long
2026-09-14 13:49 ` [PATCH net-next v15 15/15] quic: add packet parser base Xin Long
2026-09-15 19:51 ` netdev-bot+sashiko
2026-09-15 21:34 ` Xin Long
2026-09-16 18:08 ` Xin Long
2026-09-16 23:46 ` Kuniyuki Iwashima
2026-09-17 13:38 ` Xin Long
2026-09-17 19:06 ` Kuniyuki Iwashima
2026-09-18 19:51 ` Xin Long
2026-09-16 18:33 ` [PATCH net-next v15 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-09-17 8:35 ` Paolo Abeni
2026-09-18 19:59 ` Xin Long
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=178950182306.22033.14152384539754204368@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aahringo@redhat.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=chuck.lever@oracle.com \
--cc=daniel@haxx.se \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dreibh@simula.no \
--cc=edumazet@google.com \
--cc=hare@suse.de \
--cc=hepengtao@xiaomi.com \
--cc=horms@kernel.org \
--cc=illiliti@protonmail.com \
--cc=jbaron@akamai.com \
--cc=jlayton@kernel.org \
--cc=kernel-tls-handshake@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=mail@johnericson.me \
--cc=marcelo.leitner@gmail.com \
--cc=matttbe@kernel.org \
--cc=mbuhl@openbsd.org \
--cc=mef@scarletmail.rutgers.edu \
--cc=metze@samba.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul@jakma.org \
--cc=pc@manguebit.org \
--cc=quic@lists.linux.dev \
--cc=sd@queasysnail.net \
--cc=steved@redhat.com \
--cc=tfanelli@redhat.com \
--cc=tom@talpey.com \
--cc=xiyou.wangcong@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