Netdev List
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.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, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	stable@vger.kernel.org, Shailend Chand <shailend@google.com>
Subject: Re: [PATCH net 1/4] net: skbuff: limit folio refcount when copying skb frag references
Date: Sun, 22 Nov 2026 13:58:09 +0100	[thread overview]
Message-ID: <dff45fdd-aedf-4282-9d91-1a871d3c86f7@kernel.org> (raw)
In-Reply-To: <179533917558.3135.17684828734142496084@kernel.org>


> 
> [Severity: Low]
> This isn't a bug in mainline, but the refusal described here only works
> because try_get_page() enforces the refcount limit. That check was added
> by commit c6c9a4c1c9a1 ("mm: limit pagecache folio refcount when splicing
> into pipes"), which builds on 26b8f029ce52 ("mm: limit pagecache folio
> refcount when mapping pages").
> 
> Before those commits, try_get_page() had no upper bound:
> 
> 	page = compound_head(page);
> 	if (WARN_ON_ONCE(page_ref_count(page) <= 0))
> 		return false;
> 	page_ref_inc(page);
> 	return true;
> 
> This patch has Cc: stable and Fixes tags back to 800d8c63b2e9. A backport
> to a tree without the prerequisites would still compile. There,
> skb_frag_try_ref() would never refuse a reference and would only warn
> after the refcount has wrapped.
> 
> Could the commit message state this dependency, for example with a
> "# depends on" note on the stable tag?

No.

[...]

> [Severity: High]
> Can this make the converted paths fail on every packet for drivers that
> deliberately keep RX page refcounts near INT_MAX?
> 
> Every frag that is neither page_pool nor net_iov now goes through
> try_get_page()->folio_get_checked()->__folio_ref_count_over_limit(). That
> check applies to any folio, not just pagecache folios.
> 
> The gve driver uses GQI RDA/QPL and DQO-QPL, and none of these use
> page_pool. It biases its RX pages up to INT_MAX:
> 
> drivers/net/ethernet/google/gve/gve_rx.c:gve_setup_rx_buffer() {
>     ...
> 	/* The page already has 1 ref */
> 	page_ref_add(page, INT_MAX - 1);
> 	page_info->pagecnt_bias = INT_MAX;
> }

CCing the person that introduced this refcount abuse, making me angry on a Sunday.

Fix your goddamn drivers, that's just an abuse of the page refcount scheme and I
won't hack around that.

-- 
Cheers,

David

  reply	other threads:[~2026-11-22 12:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:32 [PATCH net 0/4] net: skbuff: limit pagecache folio refcount David Hildenbrand (Arm)
2026-11-18  8:32 ` [PATCH net 1/4] net: skbuff: limit folio refcount when copying skb frag references David Hildenbrand (Arm)
2026-11-19 13:53   ` David Hildenbrand (Arm)
2026-11-20 16:21   ` Stanislav Fomichev
2026-11-20 21:01     ` David Hildenbrand (Arm)
2026-11-22  9:19   ` netdev-bot+sashiko
2026-11-22 12:58     ` David Hildenbrand (Arm) [this message]
2026-11-18  8:32 ` [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags David Hildenbrand (Arm)
2026-11-22  9:19   ` netdev-bot+sashiko
2026-11-22 12:48     ` David Hildenbrand (Arm)
2026-11-18  8:32 ` [PATCH net 3/4] net: skbuff: limit folio refcount when splicing pages into skbs David Hildenbrand (Arm)
2026-11-22  9:19   ` netdev-bot+sashiko
2026-11-22 13:05     ` David Hildenbrand (Arm)
2026-11-18  8:32 ` [PATCH net 4/4] net: skbuff: limit folio refcount when splicing from sockets David Hildenbrand (Arm)
2026-11-22  9:19   ` netdev-bot+sashiko
2026-11-22 13:09     ` David Hildenbrand (Arm)

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=dff45fdd-aedf-4282-9d91-1a871d3c86f7@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=horms@kernel.org \
    --cc=kas@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ncardwell@google.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pfalcato@suse.de \
    --cc=riel@surriel.com \
    --cc=shailend@google.com \
    --cc=songliubraving@fb.com \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.org \
    /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