From: Jakub Kicinski <kuba@kernel.org>
To: Mina Almasry <almasrymina@google.com>
Cc: Jijie Shao <shaojijie@huawei.com>,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, hawk@kernel.org,
ilias.apalodimas@linaro.org, toke@redhat.com,
shenjian15@huawei.com, liuyonglong@huawei.com,
chenhao418@huawei.com, yangshuaisong@h-partners.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 net] net: page_pool: fix UAF in __page_pool_release_netmem_dma on xa_cmpxchg race
Date: Wed, 5 Aug 2026 16:11:14 -0700 [thread overview]
Message-ID: <20260805161114.409b1d81@kernel.org> (raw)
In-Reply-To: <CAHS8izMVqidVkiVHNWZMqP4Eoi5N_M3Wv1Cnn4jjxHf3=cWNQA@mail.gmail.com>
On Tue, 4 Aug 2026 20:50:46 -0700 Mina Almasry wrote:
> > Not sure this is a good idea? scrub is trying to touch just the DMA
> > mapping, right? It shouldn't try to update the page itself because
> > it has no reference to the page, the page may get freed in parallel.
> > Hopefully DMA unmap on a freed page is legal..
>
> Scrub actually frees the page in the loop in
> page_pool_empty_ring(pool), so it's not true AFAIU that it 'shouldn't
> try to update the page'.
>
> My mental model (roughly) is that the pp has a ref and that single
> last ref can be dropped in the page_pool_destroy() path or the
> page_pool_put_netmem() path, but the ref can't be dropped twice and
> the same goes for dma unmapping.
>
> Now that i look closer at the code I have no idea why we didn't 'just'
> put the dma-unmapping inside of page_pool_return_netmem(). That code
> path is already common between scrub() and put_netmem() and does the
> synchronization between these 2 paths.
from memory so likely wrong -
ring scrub is freeing pages from the cache
DMA unamp is clearing _all_ mappings, including actively on used pages
the are different sets
next prev parent reply other threads:[~2026-08-05 23:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 11:15 [PATCH v4 net] net: page_pool: fix UAF in __page_pool_release_netmem_dma on xa_cmpxchg race Jijie Shao
2026-07-31 17:37 ` Mina Almasry
2026-08-05 2:16 ` Jakub Kicinski
2026-08-05 3:50 ` Mina Almasry
2026-08-05 8:10 ` Jijie Shao
2026-08-05 23:11 ` Jakub Kicinski [this message]
2026-08-06 18:50 ` Mina Almasry
2026-08-05 2:17 ` Jakub Kicinski
2026-08-05 8:21 ` Jijie Shao
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=20260805161114.409b1d81@kernel.org \
--to=kuba@kernel.org \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=toke@redhat.com \
--cc=yangshuaisong@h-partners.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