Article View: linux.kernel.netdev
Article #5900Re: [PATCH net] octeontx2-pf: fix skb use-after-free with ipsec crypto offload
From: Nicolai Buchwitz
Date: Wed, 21 Oct 2026 06:59
Date: Wed, 21 Oct 2026 06:59
45 lines
10135 bytes
10135 bytes
Hi Ratheesh
On 21.10.2026 05:16, Ratheesh Kannoth wrote:
> On 2026-10-19 at 20:34:33, Nicolai Buchwitz (nb@tipi-net.de) wrote:
>> if (!seg) {
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> index 8d2d607bc92f9..4a20d73d27c06 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> @@ -1205,6 +1205,13 @@ bool otx2_sq_append_skb(void *dev, struct
>> netdev_queue *txq,
>> if (free_desc < otx2_get_sqe_count(pfvf, skb))
>> return false;
>>
>> + /* Crypto hardware need write permission for ipsec crypto offload */
>> + if (unlikely(xfrm_offload(skb)) && skb_cloned(skb) &&
>> + skb_ensure_writable(skb, skb->len)) {
>
> Thanks for the fix!
>
> Just wanted to double-check the behavior of `skb_ensure_writable(skb,
> skb->len)` on a cloned
> SG packet. Does it end up copying the data twice (once via
> `pskb_may_pull()` to linearize into
> the shared buffer, and again via `pskb_expand_head()` into a new
> buffer)?
>
> I'm a bit concerned about potential performance regressions.
No, AFAIU it copies once. On a cloned skb it will be
__pskb_pull_tail()
-> pskb_expand_head()
-> private head, skb->cloned cleared
The frags are copied into that head and skb_ensure_writable() returns.
That matches what the old skb_unshare() did and also only cloned
xfrm skbs take this path.
> [...]
Regards,
Nicolai
Technical Details
Message-ID:
<a790194252203ea6736acc1554206fd2@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349850-linux-kernel-netdev=dewy.ruReferences:
<20261019-nb-otx2-xfrm-unshare-net-v1-1-ee9b24f9e673@tipi-net.de> <atgugPFCpueeAiB8@rkannoth-OptiPlex-7090>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-349850-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] octeontx2-pf: fix skb use-after-free with ipsec crypto offload Date: Wed, 21 Oct 2026 08:59:27 +0200 Organization: Usenet Network Message-ID: <a790194252203ea6736acc1554206fd2@tipi-net.de> References: <20261019-nb-otx2-xfrm-unshare-net-v1-1-ee9b24f9e673@tipi-net.de> <atgugPFCpueeAiB8@rkannoth-OptiPlex-7090> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="4051465"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5+KA1c6A+bWFCafu0/6NRNAXBVw= sha256:NSiMUfeOekKMZtQM7kqeTQlEtQELjiePDt3NUzZT4Fo= sha1:dDn1s1/aO0s1x/OJ0cywTEY4c68= sha256:MOs6E/6XYvpadYEJcorA7tkqIJO2JpWoRYyXlQAVDBk= 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 EDF28110F4A; Wed, 21 Oct 2026 09:59:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de 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 IBLxN6dVcLRP; Wed, 21 Oct 2026 09:59:54 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-349850-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id AAC2F110F18; Wed, 21 Oct 2026 09:59:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 5520B2D1D4; Wed, 21 Oct 2026 06:59:39 +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=1792565977; b=a9qWK9yYYF0sskhz4INojUcpAW5CzYVzS2JueuNJWODN1VHMkEhntERrs65Gvmh2TE+1 UvrHvUCglRmYErJSizbAGs3qAW6rnjEDFfKSLGZqX/thYxzT2MmLWOjv762I7HcVqmzHm /gtAhzl+rV0EPNUHX1k4M48faj1UH6FTy3XnFaB9OFS5zc1QbaaUX/mxjcPZtqBBjEgIW XoAuy409XJ06FQMDMjX7nxueMMCZ0hrNwpBiDh+xb8bC+wBqnXU3AD8qMbCs7EkNGGDF8 79+g+YORucgiDuJA5+7CZZi5efD888rI0bPUoXH4/GAAbvP/xjAlDjfaUQWKuDK/Ccw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792565977; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=4E1IvoD9qhmZ7oCU5Y397uMFMvWE+PlDEwOMXgDmoME=; b=tNKutjgVl7NT+PV5ZsfRfO+U5BE6VIKJQEWg+zhdBLEqR/8i+c/lX+SlQsrjxyl2rjwr HeZxhMVtNK+SY7PBk74B73L+oIbEwAb28LyvBA71pePXw62cIHM6Gp3sbmOv7NsoZy0hr Kf93QUTuEbLeJFfq77hWZ89ZXHqM+w1jKNujpkiOamx6mnJP2CEtmILh5KmluFp4vEd8E o7lmPdww/W8s4UXaYfMuHnRkCIHkepsshjueYX4eH+hOj5iLWuyqTk8tFqJGoZyTH+Qhm lhoPgRfLb1ZiZ4gFd6HzBrpAZrOeK8VNEej5bqkFU3tNZzgK3MxmQDu5FR0LB97uaCg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b="Zn7ku/p2"; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; 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 7B28B606A321; Wed, 21 Oct 2026 06:59:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=Zn7ku/p2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792565976; b=kAbJVMs7+1oqAzvjH1rqzHfLrkp3W3QNFUBI6iPw7bCM+/WvGT6W2cGBk/DwR25HdAeq fts5BlCCweDhuRKd4eAHm9kzEJ5v/mhs1xxjp79DImOxIovXl8WTw3wdOMNMTJnBz7t46 rMRs6AeNxuqjroO4/xvEERASyyMsO7hF+YOjPxckgax1+dNTDYk1mWZ6+QI5TP15G7sUe NChzY6Zw6EpRxtd1NjrfKwU5gKtErJRWwECBMA/DYRKDXpgPzRBrqDmxrY60wi9X61fWU FmSI1sRMop1Csp/CbhmeDn5fgqXgR2EORrk2svpbwoI/dGtn7p8pQ3o2WNxsq7GRbWg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792565976; h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc: Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=4E1IvoD9qhmZ7oCU5Y397uMFMvWE+PlDEwOMXgDmoME=; b=sc5ovTgYDrT+nu/hc26SR4zvDFJ/ZmlqzR95eFGzpY1Y7OhSU/ql/MdCVuBrZTEBGTBQ duzvpHQQcxRwgtK3M+0R+hUgnX3fffdFtCCYVCmO64AvmgBiSZjSqUurIJ5YCMl7HOlJ6 ofbmvEO7UJ1BiS1Lok6Hwf6O3OWrQ9xzuDrHw1udzwwFcM0ZbGWGbsSTU5hja4X5k0epV huhGsF/pLMnuWT26kPatWfTBc13dyieaiX4M7S4KjkEl2p7gIFdkAKWavEImJim7EdrYF LHwyABt07LhtQBHwXoyTiAw5ifZjxn5+2kMTccqyulLkkbFtz8ktYXL+ndWFfXFttaw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b="Zn7ku/p2"; arc=none smtp.remote-ip=194.13.80.246 X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7638606A31A; Wed, 21 Oct 2026 06:59:32 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7638606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 504FEA1622; Wed, 21 Oct 2026 08:59:27 +0200 (CEST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1792565969; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=4E1IvoD9qhmZ7oCU5Y397uMFMvWE+PlDEwOMXgDmoME=; b=Zn7ku/p2WoykhCQg7+gy4mHa3HKascBIN/yrC99eSPApT1zuMTU9gGtYjhkkCI7TB5NoF3 1vDsyXUXnchaYX2dVCzStiIyWK0WO08CY5GjHIVbN5T15EGKNlQwQwn4ATDUTdlEDIUz9+ X3afEZ7UEgNBJMCbFNiyCYuaR6nD5vLSBwvkcfFq4+QiLyFGuJd/cxX/9xDEBuiHcfpXi4 m3q8+LAhgjHouCOOUV8UWnPuGStD+gmz78HcbhUqrzjGtRA+NpMr+1szj9zUqYW6cPusC1 7wkQ6ppR8bOfBuEPB71BLbmqCY63LaCtZIKIGvyGD40/eFTF7LiLHyfyt+DxaQ== 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 X-Cc: Sunil Goutham <sgoutham@marvell.com>, Geetha sowjanya <gakula@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com>, Bharat Bhushan <bbhushan2@marvell.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <atgugPFCpueeAiB8@rkannoth-OptiPlex-7090> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3