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@kernel.org,
pabeni@redhat.com, horms@kernel.org, metze@samba.org,
mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
dreibh@simula.no, jamie.bainbridge@gmail.com,
linux-cifs@vger.kernel.org, pc@manguebit.org,
linkinjeon@kernel.org, tom@talpey.com,
kernel-tls-handshake@lists.linux.dev, cel@kernel.org,
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, kuniyu@google.com
Subject: Re: [PATCH net-next v19 08/15] quic: add path management
Date: Tue, 24 Nov 2026 01:21:15 +0000 [thread overview]
Message-ID: <179548327574.3135.6574572531783833085@kernel.org> (raw)
In-Reply-To: <6a6d9da5d2d7ae5dfd1a6cdcd409326023fc7c2c.1795393691.git.lucien.xin@gmail.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In net/quic/path.c, quic_path_bind() decides whether a path
may take a port by looking at the credentials of the task that happens…
- [Medium] quic_path_bind() binds a real UDP port (explicit or ephemeral)
on behalf of the caller via quic_udp_sock_create() ->…
- [Low] The comment on quic_path_detect_alt() in net/quic/path.c does not
describe what the function does.
- [Low] Two PLPMTUD field comments in struct quic_path_group
(net/quic/path.h) do not match how path.c uses the fields.
--
quic: add path management
This patch adds struct quic_path_group to manage the active and alternate
QUIC paths. Each path is backed by a refcounted UDP tunnel socket wrapper
(quic_udp_sock) kept in a global hash table, with helpers to bind, unbind,
swap and detect alternate paths for connection migration. It also adds a
basic PLPMTUD state machine that is driven by probe sends, ACKs and ICMP
feedback.
> diff --git a/net/quic/path.c b/net/quic/path.c
> new file mode 100644
> index 0000000000000..946f5e44b6350
> --- /dev/null
> +++ b/net/quic/path.c
> @@ -0,0 +1,608 @@
[ ... ]
> +static struct quic_udp_sock *quic_udp_sock_create(struct sock *sk,
> + union quic_addr *a)
> +{
[ ... ]
> + us = kmalloc_obj(*us);
> + if (!us)
> + return ERR_PTR(-ENOMEM);
> +
> + quic_udp_conf_init(sk, &udp_conf, a);
> + err = udp_sock_create(net, &udp_conf, &sock);
[Severity: Medium]
Can this let a confined, unprivileged process bind UDP ports that its LSM
policy does not allow?
udp_sock_create() goes through udp_sock_create4()/udp_sock_create6(), which
call sock_create_kern() and then kernel_bind():
net/ipv4/udp_tunnel_core.c:udp_sock_create4() {
...
err = sock_create_kern(net, AF_INET, SOCK_DGRAM, 0, &sock);
...
err = kernel_bind(sock, (struct sockaddr_unsized *)&udp_addr,
sizeof(udp_addr));
...
}
kernel_bind() in net/socket.c calls sock->ops->bind() directly. That means
security_socket_bind() never runs for the UDP socket that actually holds
the port.
The socket is also created with kern=1, so it gets a kernel label instead
of the caller's. The user socket create hooks (LSM and cgroup-BPF inet sock
create) are skipped as well.
The only remaining bind check is on the QUIC socket. SELinux classes an
IPPROTO_QUIC socket as rawip_socket, and sel_netport_sid() with
sk_protocol == IPPROTO_QUIC does not match any udp port labels.
As a result, the port bound here is not covered by udp_socket
name_bind/node_bind rules with per-port labels, or by Smack/AppArmor network
rules. Per-packet LSM checks and netfilter socket-owner matching would also
see a kernel socket rather than the user.
Other UDP tunnel users either require CAP_NET_ADMIN (vxlan, geneve, fou,
tipc) or take the port from an admin sysctl (SCTP over UDP). Here an
unprivileged user picks the port. The CAP_NET_BIND_SERVICE and uid checks in
quic_path_bind() do not mediate the UDP bind itself.
quic_path_bind() has no callers yet in this series. quic_bind() and
quic_connect() arrive in the next patchset, so the user-reachable path
can't be confirmed here.
Does the UDP tunnel bind need some form of LSM mediation before the port is
bound on the caller's behalf?
[ ... ]
> +/* Binds a QUIC path to a local port and sets up a UDP socket. */
> +int quic_path_bind(struct sock *sk, struct quic_path_group *paths, u8 path)
> +{
[ ... ]
> + port = ntohs(a->v4.sin_port);
> + if (port) {
> + if (inet_port_requires_bind_service(net, port) &&
> + !ns_capable(net->user_ns, CAP_NET_BIND_SERVICE))
> + return -EACCES;
> + head = quic_udp_sock_head(net, port);
> + mutex_lock(&head->lock);
> + us = quic_udp_sock_lookup(sk, a, port);
> + if (us) {
> + if (!uid_eq(current_fsuid(), sk_uid(us->sk))) {
> + mutex_unlock(&head->lock);
> + return -EADDRINUSE;
> + }
[Severity: Medium]
Is it intended that both checks here use the credentials of the task that
calls quic_path_bind(), rather than the QUIC socket's own credentials?
The ns_capable(CAP_NET_BIND_SERVICE) check runs before the lookup. So it
also applies when an existing tunnel socket is only being reused and
refcounted.
The reuse branch then compares current_fsuid() with sk_uid(us->sk). That
value is the fsuid of whoever first created the kernel tunnel socket.
For comparison, the SO_REUSEPORT model in inet_csk_bind_conflict() and
udp_lib_get_port() compares the new socket's sk_uid with the existing
socket's sk_uid.
Consider a server that binds port 443 as root and then drops privileges. A
later explicit-port quic_path_bind() for 443, for example for an accepted
child socket or a migration path, would get -EACCES (capability gone) or
-EADDRINUSE (fsuid changed). Is that the expected result?
Likewise, a QUIC socket passed to another process via SCM_RIGHTS would be
judged by the receiver's credentials. A kernel thread caller would pass
both checks no matter who owns the socket.
The commit message and the code comments don't describe this model. The
only mention is the v15 changelog line. quic_path_bind() has no callers in
this series, so whether a reuse bind can follow a privilege drop depends on
the next patchset.
Would comparing sk_uid(sk) against sk_uid(us->sk), or at least documenting
the intended model, make sense here?
[ ... ]
> +/* Detects and records a potential alternate path.
> + *
> + * If the new source or destination address differs from the active path, and
> + * alternate path detection is not disabled, the function updates the alternate
> + * path slot (path[1]) with the new addresses.
> + *
> + * This is typically called on packet receive to detect new possible network
> + * paths (e.g., NAT rebinding, mobility).
> + *
> + * Returns true if the alternate path (path[1]) matches (sa, da), regardless
> + * of whether it was newly detected or already present. Returns false if the
> + * addresses don't match the alternate path.
> + */
> +bool quic_path_detect_alt(struct quic_path_group *paths, union quic_addr *sa,
> + union quic_addr *da, struct sock *sk)
> +{
[ ... ]
> + if (!quic_path_saddr(paths, 1)->v4.sin_port)
> + quic_path_set_saddr(paths, 1, sa);
> +
> + if (!quic_cmp_sk_addr(sk, quic_path_saddr(paths, 1), sa))
> + return false;
> +
> + if (!quic_path_daddr(paths, 1)->v4.sin_port)
> + quic_path_set_daddr(paths, 1, da);
> +
> + return quic_cmp_sk_addr(sk, quic_path_daddr(paths, 1), da);
> +}
[Severity: Low]
This isn't a bug, but the comment doesn't match the code. It says path[1]
is updated with the new addresses, but path[1] is never overwritten. Only a
saddr or daddr whose port is 0 gets filled in.
The function can also modify path[1] and still return false. Suppose
path[1].saddr is empty but path[1].daddr already holds a different peer
address. Then path[1].saddr is set to sa, the daddr comparison fails, and
the function returns false.
That leaves path[1] with the new source paired with the old destination,
which matches neither candidate. The "Returns false if the addresses don't
match the alternate path" text implies the false case has no side effects.
Within this patch, path[1].daddr is only set by quic_path_detect_alt()
itself (saddr first) or by quic_path_swap(). quic_path_unbind() clears both
fields together, so this half-written state may not be reachable yet.
Could the comment describe the fill-only-empty-fields behaviour and the
possible partial update on a false return?
[ ... ]
> diff --git a/net/quic/path.h b/net/quic/path.h
> new file mode 100644
> index 0000000000000..c2537cf65a7d4
> --- /dev/null
> +++ b/net/quic/path.h
> @@ -0,0 +1,191 @@
[ ... ]
> + /* MTU discovery handling */
> + struct { /* PLPMTUD probing (rfc8899) */
> + s64 number; /* Packet number used for current probe */
> + u16 pmtu; /* Confirmed path MTU */
> +
> + u16 probe_size; /* Current probe packet size */
> + u16 probe_high; /* Highest failed probe size */
> + u8 probe_count; /* Retry count for current probe_size */
[Severity: Low]
This isn't a bug, but these two field comments don't match how path.c uses
the fields.
probe_high is also set when no probe has failed. In SEARCH state,
quic_path_pl_recv() does this once probe_size reaches the 9000 byte cap:
paths->pl.probe_high = QUIC_MAX_PLPMTU;
so the field works as an upper search bound, not only as a failed size.
probe_count is incremented on every quic_path_pl_send() call, including the
first probe of a new size:
paths->pl.probe_count++;
so the probe_count < QUIC_MAX_PROBES check counts total probes sent for the
current size, not retries.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795393690.git.lucien.xin%40gmail.com
next prev parent reply other threads:[~2026-11-24 1:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 0:27 [PATCH net-next v19 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-11-23 0:27 ` [PATCH net-next v19 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:27 ` [PATCH net-next v19 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-11-23 0:27 ` [PATCH net-next v19 03/15] quic: provide common utilities and data structures Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 04/15] quic: provide family ops for address and protocol Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-11-23 0:28 ` [PATCH net-next v19 06/15] quic: add stream management Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 07/15] quic: add connection id management Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 08/15] quic: add path management Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko [this message]
2026-11-23 0:28 ` [PATCH net-next v19 09/15] quic: add congestion control Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 10/15] quic: add packet number space Xin Long
2026-11-23 0:28 ` [PATCH net-next v19 11/15] quic: add crypto key derivation and installation Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
2026-11-23 0:28 ` [PATCH net-next v19 13/15] quic: add timer management Xin Long
2026-11-23 0:28 ` [PATCH net-next v19 14/15] quic: add packet builder base Xin Long
2026-11-23 0:28 ` [PATCH net-next v19 15/15] quic: add packet parser base Xin Long
2026-11-24 1:21 ` netdev-bot+sashiko
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=179548327574.3135.6574572531783833085@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aahringo@redhat.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=cel@kernel.org \
--cc=daniel@haxx.se \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dreibh@simula.no \
--cc=edumazet@kernel.org \
--cc=hare@suse.de \
--cc=hepengtao@xiaomi.com \
--cc=horms@kernel.org \
--cc=illiliti@protonmail.com \
--cc=jamie.bainbridge@gmail.com \
--cc=jbaron@akamai.com \
--cc=jlayton@kernel.org \
--cc=kernel-tls-handshake@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--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