Article View: linux.kernel.netdev
Article #10720Re: [PATCH net v4 1/7] net/mlx5e: psp: drop ipv6 packets with extension headers
From: netdev-bot+sashiko
Date: Wed, 04 Nov 2026 00:44
Date: Wed, 04 Nov 2026 00:44
156 lines
13774 bytes
13774 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 (1) ยท Low: 0
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).
- [High] The patch rejects only some packets, and it does so in mlx5.
Pre-existing issues:
- [Medium] This problem wasn't introduced by this patch, but the patch
adds a new, user-triggerable way to reach it.
--
net/mlx5e: psp: drop ipv6 packets with extension headers
This adds an mlx5 check, mlx5e_psp_l4_is_tcp(), that drops PSP-associated
TX packets when TCP does not directly follow the fixed L3 header. IPv6
packets with extension headers are now dropped instead of going out
malformed and unencrypted. It also adds a comment to
psp_dev_encapsulate() saying the helper assumes there are no IPv6
extension headers.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
> index 348fd7a962615..c9829a124c533 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
[ ... ]
> @@ -170,8 +183,9 @@ bool mlx5e_psp_handle_tx_skb(struct net_device *netdev,
> if (!mlx5e_psp_set_state(priv, skb, psp_st))
> return true;
>
> - /* psp_encap of the packet */
> - if (!psp_dev_encapsulate(net, skb, psp_st->spi, psp_st->ver, 0)) {
> + /* psp_encap of the packet. only tcp right after the ip header */
> + if (unlikely(!mlx5e_psp_l4_is_tcp(skb)) ||
> + !psp_dev_encapsulate(net, skb, psp_st->spi, psp_st->ver, 0)) {
> kfree_skb_reason(skb, SKB_DROP_REASON_PSP_OUTPUT);
> atomic_inc(&priv->psp->tx_drop);
> return false;
[Severity: Medium]
This is a pre-existing issue, but this patch gives userspace a new
and predictable way to hit it.
When this returns false, mlx5e_accel_tx_begin() fails, and mlx5e_xmit()
returns without flushing the SQ:
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c:mlx5e_xmit() {
...
/* May send SKBs and WQEs. */
if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel)))
return NETDEV_TX_OK;
...
}
Suppose the previous packet on the same SQ was posted with
xmit_more=true. Its doorbell was then deferred in
mlx5e_txwqe_complete():
send_doorbell = __netdev_tx_sent_queue(sq->txq, attr->num_bytes, xmit_more);
if (send_doorbell)
mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg);
In the MPWQE path, the session can also be left open by
mlx5e_sq_xmit_mpwqe().
The DMA error paths in mlx5e_sq_xmit_wqe() and mlx5e_sq_xmit_mpwqe() call
mlx5e_tx_flush() for this reason. The accel drop path does not call it.
Before this patch, the PSP part of this path was only reached when
psp_dev_encapsulate() failed, for example when skb_cow_head() ran out of
memory. With mlx5e_psp_l4_is_tcp(), every PSP-associated IPv6 packet with
an extension header takes this path. Such headers can come from
IPV6_RTHDR, IPV6_DSTOPTS or IPV6_HOPOPTS on the socket, or from a route.
If such a packet is the last one in a qdisc bulk dequeue batch, the
earlier descriptors are not announced to the NIC. They stay that way
until the next successful transmit on that SQ. Since the queue is not
stopped, the TX watchdog will not fire either.
Should the accel drop path in mlx5e_xmit() call mlx5e_tx_flush() like the
other drop paths do?
[ ... ]
> diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
> index c9c1a8826b7f9..5049ed400be07 100644
> --- a/net/psp/psp_main.c
> +++ b/net/psp/psp_main.c
> @@ -272,6 +272,7 @@ bool psp_dev_encapsulate(struct net *net, struct sk_buff *skb, __be32 spi,
> ip_hdr(skb)->check =
> ip_fast_csum((u8 *)ip_hdr(skb), ip_hdr(skb)->ihl);
> } else {
> + /* assumes there are no ipv6 extension headers */
> ipv6_hdr(skb)->nexthdr = IPPROTO_UDP;
> be16_add_cpu(&ipv6_hdr(skb)->payload_len, PSP_ENCAP_HLEN);
> }
[Severity: High]
Should this assumption be enforced in psp_dev_encapsulate() rather than
only documented?
The malformed packet is built here, in the shared helper. bufflen
includes skb_network_header_len(), so udp+psp is inserted after any
extension headers. Then only the fixed header's nexthdr is rewritten to
UDP, and psp_write_headers() sets the PSP nexthdr to TCP.
The new check, mlx5e_psp_l4_is_tcp(), only covers mlx5. The other caller,
nsim_do_psp() in drivers/net/netdevsim/psp.c, has no such check:
drivers/net/netdevsim/psp.c:nsim_do_psp() {
...
net = sock_net(skb->sk);
if (!psp_dev_encapsulate(net, skb, pas->tx.spi, pas->version, 0)) {
rc = SKB_DROP_REASON_PSP_OUTPUT;
goto out_unlock;
}
...
}
So with netdevsim, a PSP-associated IPv6 TCP socket that has IPV6_RTHDR,
IPV6_DSTOPTS or IPV6_HOPOPTS set, or uses a route that adds extension
headers, still sends the malformed packet to the peer.
The selftest patch in this series ("selftests: drv-net: psp: test ipv6
tcp socket with extension headers") says that netdevsim encapsulates
these packets "in a malformed way". It skips netdevsim instead of fixing
it:
# netdevsim doesn't drop them: it sends them malformed
cfg.require_nsim(nsim_test=False)
psp_dev_encapsulate() already validates its input and returns false for
a non-IP skb->protocol:
if (skb->protocol != htons(ETH_P_IP) &&
skb->protocol != htons(ETH_P_IPV6))
return false;
Both callers treat false as a drop with SKB_DROP_REASON_PSP_OUTPUT.
Could the "TCP directly follows the fixed L3 header" check go next to
that existing check instead? That would fix both callers, protect any
future users of the helper, and make mlx5e_psp_l4_is_tcp() unnecessary.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103001143.246081-1-toddfreed%40meta.com
Technical Details
Message-ID:
<179375308260.488856.17581878664897272479@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356097-linux-kernel-netdev=dewy.ruReferences:
<20261103001143.246081-2-toddfreed@meta.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356097-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 1/7] net/mlx5e: psp: drop ipv6 packets with extension headers Date: Wed, 04 Nov 2026 00:44:42 +0000 Organization: Usenet Network Message-ID: <179375308260.488856.17581878664897272479@kernel.org> References: <20261103001143.246081-2-toddfreed@meta.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3295477"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:QZ+QLa8r3aSRKL/mmsam7oDZVKk= sha256:ZW06mibxJcsfUsMRu/1LSSSOOgJHR6mNxAp1nDfAA+U= sha1:qw4y+S86L2wUL7JsgVAluVCvtNg= sha256:hvj/oRAX9GuG6UUVU+3/R0IwBs0MN58fhx6BUDpulss= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 20BAE112A84; Wed, 4 Nov 2026 03:45:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vlgccgbHkmmJ; Wed, 4 Nov 2026 03:45:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-356097-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id BDABA112988; Wed, 4 Nov 2026 03:44:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E947B292A8; Wed, 4 Nov 2026 00:44:50 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793753090; b=vwinvkGayKrtylTbyvcldnWqMmf3XCY7qplrhPEOMR3yKjnCcmKI0rMjANI0oPR9KYpJ viNVAbJq0+cZmyoKr5lr58xLvvZJLDbL7cspKLR4VvJ0feC0V27T3VNUqCZUdFm3EufV7 9JE346LWLQsQWluQdmx4egjfhyI772DDOUffgwzqWdiBDi0wx5d6do/jarIEOn3m8vFK+ K5UdPADJxHNfhhzpPziHbBUcVH1IMI8Gf+bZZ+Z264Zu2aeUmMUBflV9oF1h+IN5h7i/d WxPc1AZ0G0gUQR86hfbx6h6RqFlX4RFCmrtTj3OmJ/s9H8ATJYxUbc1ODxZVg3QpxQQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793753090; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Ped2xn6GpwSUqsZ+O4fRYGiZsrjuxF7xbLOr6gCO5yk=; b=RfESyLCDEg8W1Z33Rlzazt2vr+gxqefaqoMgwcDJ+w375DxVprd/vS/7ltyHLSjwCdWD 4KX2PO+38Oi9vOVE79+S93tFOGEiA3Uq+6gLfzzSKPwvuNGlb4iGBrFUCs8vsEzeyLV5V ErGmAlO33pvCyXgEpGzsaaCZt65+i2+OouO8/3VU6YfayGdda1jODOIrQxE/5LXOGia2l M+VJe9h23jiPW9KzahqZdHhQX4g1HLPijLBrtmrVSzWTOYs9GIOvtDz1bnqh490My1JD0 qp6NCFmCS/n2HvRcABH8vr1srcZKhv01qwONe8PpFUpUbS6/rLHHYotg0CDsSx60yzQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="m+I/V2PT"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF4E5606A33D; Wed, 4 Nov 2026 00:44:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=m+I/V2PT X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793753084; b=zQCwA7xKKsokyK+PmU5vd4JFP6FVSCwjCC5eKsGjtHmOrO4BQQ4DpGBTu+AHj3fmVr5V HOQpDrEIlDhwL9gDu19lZ5r3prAJxxdWmuz+uwMubemdxUG+P46g4SJyE7ptuQoDqzTx1 t62ZdWkfhKq7jyzDDLpDPLsRx3n6+HPfPYDHDdxHi71UJXpOlK2Ioptoyy2yktCCTJZfk E6GJZXvhRj6DHCwD7agJXa2hWQ9tuke8fdaY5Ql7S5LwoIk2UvKNU07DabRzNo3wKNnBD 6mNV8MEsKkGP4NzPxNcfRjoJDq9QlqCxSePaUquXNWuAaDNgsDOf9XzbEhc3LjGT/sg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793753084; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Ped2xn6GpwSUqsZ+O4fRYGiZsrjuxF7xbLOr6gCO5yk=; b=Q4jOhn6UjBYr5vvFI/XHlIMgrRHPNmPB7ppji0NdXEVVY3TXF2y1QnFCqrFFTBoY7vzv 3KZlqH1Z9EyGjLIZk0uUeOeUI1U+c0xyAzWUaKD4ECa3ebzYfsOE5Kr8xl8Q9LVCcI0Ec xtO+JgWX25MDZNrtau2BBzbihKCQ0ibSge78Bfp8P70suy5eXZvpHcoXyJCa3IsysvNiY LPrZcNfIfamSSvIySYaPX0e6vT+O+c7/SmvSPtsLFeAn9eNmttQMRpniF7+A57o4R3o52 HyRVK5yEZoNrNg9DGf2VcCrL3OSU98VMJLq2FXaV9442Em/uL6AX6eEXXPFRYOXxAFg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="m+I/V2PT"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9951606A31B; Wed, 4 Nov 2026 00:44:43 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16DC11F00919; Wed, 4 Nov 2026 00:44:43 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793753083; bh=Ped2xn6GpwSUqsZ+O4fRYGiZsrjuxF7xbLOr6gCO5yk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=m+I/V2PTBOm9X/Ekvvy9TISlLwWPoZMj6Lo1J60okmN58SIWLmCmQ7WhZL8e3UPhK oz7G0QaZ6Dy+ycyAu8lFoPheIVMHH7dlVLhTSw8a44bbzCuSN+dzWHMW0wvXqVNeEc DeRTL4r+y597I7qIkicsp8uOGkW6XFnn48oL+UhFbjgtFI77goUReBf4gWh+vqtDvN kYjkZ8fBhvvtUbQ8AFQYCsx9+6/q5Jlo9E59QE1U+fackdE/cuBYqE1Ua7+K05mNbz WMCUQ44JgtpfMCA5NvWsPwlI3QGh9H/BV8ndmpRC4/qiLWlRdHy48af4bk8xFHKYhs 3lQdCZVt4hKbQ== X-Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, sashiko-bot@kernel.org, kuba@kernel.org, bjorn@kernel.org X-In-Reply-To: <20261103001143.246081-2-toddfreed@meta.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list