Article View: linux.kernel.netdev
Article #23740Re: [PATCH net v2 3/4] net: skbuff: limit folio refcount when splicing pages into skbs
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 21:21
Date: Fri, 27 Nov 2026 21:21
105 lines
11704 bytes
11704 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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 refcount-limit fix does not cover kernel TLS, so the case
the commit message uses as its example (sunrpc/nfsd sending pagecache…
--
net: skbuff: limit folio refcount when splicing pages into skbs
This commit changes skb_append_pagefrags() to use try_get_page() instead
of get_page(). In-kernel MSG_SPLICE_PAGES senders that pass pagecache
pages directly, such as sunrpc, can then no longer push a folio's
refcount past the limit. On failure it returns -EFAULT rather than
-EMSGSIZE, so TCP does not just retry with a new skb.
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 6da51ad8fd440..957335bcc5961 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4714,8 +4714,13 @@ int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
> if (skb_can_coalesce(skb, i, page, offset)) {
> skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], size);
> } else if (i < max_frags) {
> + /*
> + * Don't use -EMSGSIZE, as callers would just retry with a new
> + * skb.
> + */
> + if (!try_get_page(page))
> + return -EFAULT;
> skb_zcopy_downgrade_managed(skb);
> - get_page(page);
> skb_fill_page_desc_noacc(skb, i, page, offset, size);
> } else {
> return -EMSGSIZE;
[Severity: High]
Does this cover sockets that have kTLS installed? The commit message uses
sunrpc/nfsd as its example. With kTLS, though, MSG_SPLICE_PAGES never
reaches skb_append_pagefrags().
With software kTLS the call chain is:
tls_sw_sendmsg()
tls_sw_sendmsg_splice()
sk_msg_page_add()
sk_msg_page_add() in include/linux/skmsg.h still takes the reference
without a check, and it has no way to return an error:
static inline void sk_msg_page_add(struct sk_msg *msg, struct page *page,
u32 len, u32 offset)
{
struct scatterlist *sge;
get_page(page);
...
}
With TLS device offload, the MSG_SPLICE_PAGES branch in tls_push_data()
passes the extracted page to tls_append_frag(). That function also uses
plain get_page(), and the reference is held until the record is ACKed:
net/tls/tls_device.c:tls_append_frag() {
...
} else {
++frag;
skb_frag_fill_page_desc(frag, pfrag->page, pfrag->offset,
size);
++record->num_frags;
get_page(pfrag->page);
}
...
}
nfsd reaches these paths with xprtsec=tls:
- nfsd_read_splice_ok() only turns off splice reads for krb5i and krb5p.
- So nfsd_splice_read() still puts pagecache pages into rq_res.
- svc_tcp_sendmsg() then sends them with MSG_SPLICE_PAGES through
sock_sendmsg(), which goes to tls_sw_sendmsg() or tls_device_sendmsg().
nvme-tcp over TLS also sends pages with MSG_SPLICE_PAGES and goes through
the same paths.
The sunrpc client does not seem to use MSG_SPLICE_PAGES, since
XS_SENDMSG_FLAGS is MSG_DONTWAIT | MSG_NOSIGNAL. The server side is the
case that matters here.
Should sk_msg_page_add() (or tls_sw_sendmsg_splice()) and the zero-copy
tls_append_frag() path also use try_get_page() and fail with -EFAULT in
the same way? No other patch in the series appears to touch net/tls or
include/linux/skmsg.h.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-skb_refcount_overflow-v2-0-a6f600a5634a%40kernel.org
Technical Details
Message-ID:
<179581451032.3135.17667643003292457918@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372948-linux-kernel-netdev=dewy.ruReferences:
<20261126-skb_refcount_overflow-v2-3-a6f600a5634a@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372948-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 3/4] net: skbuff: limit folio refcount when splicing pages into skbs Date: Fri, 27 Nov 2026 21:21:50 +0000 Organization: Usenet Network Message-ID: <179581451032.3135.17667643003292457918@kernel.org> References: <20261126-skb_refcount_overflow-v2-3-a6f600a5634a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="821197"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Us84PGKVC6vXhWXYyUauawPYh8U= sha256:X7utoMOC5LjVmn0e2OVbPIuIWbABi6GYy1VN1XBhZuE= sha1:YBcqxl0VTd6/hOJJij3hOTOpIoo= sha256:Q3y+rxfa16jIHZ0RV7Aa8l+X6BeYwRvAyTihGEnIzys= 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 465A1125F69; Sat, 28 Nov 2026 00:22:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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] 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 czkcb9lrZxAn; Sat, 28 Nov 2026 00:22:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-372948-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id C03B7125F65; Sat, 28 Nov 2026 00:22:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id EEBB46063B1; Fri, 27 Nov 2026 21:22:01 +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=1795814518; b=OhAQkHbUgtB2O7MqfizNSJTppifE5GAJCvNFO0M1FJ8emAwZDW9IuSj2+1mpKlzZgvWa Jngmuh1hV9XBNoM+97aHuepRRwtaVgSFAc3odRgf5QQApq8CXtk51CjMzQmuuXiHosWsW xVVccl44If8/m19SHuGaMfn58aLiXRyauQ0PfweOSoH26IfgwkjHETTNjpfZHDBSf264I +ZoUNMcbtBcFE+/ZtFi4TkpxUKXD2VHapMScsw/L371+5kypja1NW5T5TJ7ajGAD6cYmY RRv5TsX1OA+KS1jI5OMUpqjwPllKvjHnTIhVTF2g23TCmURTVb8ETthC50r3I+YEDEQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795814518; 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=YIRTDuQE4r/aXiKDRPP0uS7lZ5Ydoef491BfdGmULdw=; b=xzRS/SKkLN06H/yYsHqc4tdCs9xkQ3rIbCO6d6d3LQbjxDbPMwjjQX1PYVF9M/XUE1hg oJSK0a0w5xBm58oJbBvegPLEvgMInwLcP01YJGWRWC5ZeKGvDj+4WG/+yvjfr5VnZefxJ +vWOwFud3U3+H1r631qf5fF+aUGDDWOEia+bN2Ea7JwozZFUjz/gVJ96Zi+GbEr/A7J2m UdXnehIt0RC3K5UZC9IYqTKCsJRFO4GEG/T8KHAkKJI+/7CnhU5oMEs7zM65GkLpLdLcb jj6JLO30NA7TKH8mdOE7mHsAfkV0sTd8bRPKNHmW/wBDPYUrsaUW1KtxOJbq99iqUEA== 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=GyXeg09V; 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 51FFB606A337; Fri, 27 Nov 2026 21:21:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GyXeg09V 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=1795814512; b=oCUCPO3SK2pJHEAFH/qpr58t3gej9NjZ3XfoEg4CMDeAERHKmHGCMA1xv91KoeekcI8S BiLcCygMVPqSUr9N+SZpC0Fj6z6jXr4YsndIvEeXVaU+v6wgLRoW9JiACKdQ4WCg/QOWQ NRPoB09Uj6a6xBGzy15CPD2zss/2Iza3mr8jxxVpro3V5JoydI/KVmAgCyX0BewsYK8kc /jvryj+LyUQh076zs+WWNSSo+nFCI0H87V4r7duy/Ozu7cJ+Z6k2sCYOeerk8TA204ea7 F3tmk/rHEbsUyNhttB8YlTcOJGJ6+jIqiG/80qSu7fXuBTVsPOLcT12H1OmpWjBVqDg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795814512; 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=YIRTDuQE4r/aXiKDRPP0uS7lZ5Ydoef491BfdGmULdw=; b=F5TpXjvGkpPwermH61p12B9DRNVjKI9g77lLVLP72sCbBhzSGP5JCLO811U25/gihK5N bgMjn/upFHtl0B0FYRopPh7Fzby0oXSlIlU7R5eSoRZmTIIMpkbe8/qUFzUTQe1mpPRhK QBcXGjN6Wki14II00E/dY16ijCyQnZtrpVadXC9QY97l5OgN3EZAFPo0rpbbm0iFJuBdb VhjBMNJWePmzMLpKHImVA+tf7LRzGAoEKmO46NUQS04Qupd6bzijeYbnrnt1cfcchhyhR 6U3HRF+Dr3yaE6V/ye27K3S9aEjIeAy1KFbQK7no4P2SDfRoHxF22+6LzZ1xtmvUFUw== 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=GyXeg09V; 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 6ED76606A336; Fri, 27 Nov 2026 21:21:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFDD91F00897; Fri, 27 Nov 2026 21:21:50 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795814512; bh=YIRTDuQE4r/aXiKDRPP0uS7lZ5Ydoef491BfdGmULdw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GyXeg09VB0wAl0TmCP+UxG6RrRmfqXEG/4IhxJ1zoEH9+INmjqQYNKNW4+b5QtRfR a3BcfF8GGG9UpO8uDuxoTgZdzukxLv6z835qNLUvGZFLqAvcsIvzNZXers5+YqN++K Vd5kyeQlCd0MtrhRzUSsUEMiaobcSmqLmrd1+G1HmEweLidfTv69X4gvyXHbzWJ8eP yYA9yyYffm5lqcZcc88Ppw9imIM8tpLNdK5ncLgOXbvjk8GQnt1xvVYxIdaelCsYTk 6f6CshpkX6nsGDDWnyC0tNwO9L6M+wdB49AHjiNNsJ9Xi6fk5sUqHarMJQrYdb5Vtc tK03Xs9SeMDUA== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, sdf.kernel@gmail.com, willemb@google.com, horms@kernel.org, akpm@linux-foundation.org, kas@kernel.org, songliubraving@fb.com, hannes@cmpxchg.org, riel@surriel.com, willy@infradead.org, ncardwell@google.com, kuniyu@google.com, pfalcato@suse.de, cel@kernel.org, jlayton@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org X-In-Reply-To: <20261126-skb_refcount_overflow-v2-3-a6f600a5634a@kernel.org> 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