From: Aveline Noir <jm5905938@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: airlied@gmail.com, apopple@nvidia.com, balbirs@nvidia.com,
christian.koenig@amd.com, dri-devel@lists.freedesktop.org,
"Francois Dugast" <francois.dugast@intel.com>,
intel-xe@lists.freedesktop.org, jgg@nvidia.com, jgg@ziepe.ca,
leon@kernel.org, leonro@nvidia.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Matthew Brost" <matthew.brost@intel.com>,
mm-commits@vger.kernel.org, "Mika Penttilä" <mpenttil@redhat.com>,
Patchwork <patchwork@emeril.freedesktop.org>,
"Shuah Khan" <shuah@kernel.org>, "SeongJae Park" <sj@kernel.org>,
thomas.hellstrom@linux.intel.com,
"Vlastimil Babka" <vbabka@suse.cz>,
ziy@nvidia.com
Subject: Re: [PATCH] mm/hmm: account for subpage offsets in device-private PMDs
Date: Mon, 23 Nov 2026 01:45:21 +1100 [thread overview]
Message-ID: <179535872126.34.4789080961796247940.b4-reply@b4> (raw)
In-Reply-To: <20261122015246.d8b6b98ff5a8157168156339@linux-foundation.org>
Hi Andrew,
On Sun, 22 Nov 2026 01:52:46 -0800 Andrew Morton wrote:
> Store the corresponding RAM backing page instead.
This avoids the oops on the first read through the second descriptor,
but leaves a stale backing page pointer after CPU faultback.
Since the mirror XArray entries don't take a page reference, they rely
on invalidation. When the CPU later faults the page back to RAM,
dmirror_interval_invalidate() skips MMU_NOTIFY_MIGRATE for the same
mdevice, and dmirror_devmem_fault_alloc_and_copy() only clears the
migrating descriptor's entry before the backing folio is freed. The
second descriptor still points to that freed backing page.
Reading the same page again through the second descriptor in QEMU
triggers a KASAN use-after-free in dmirror_do_read(), and the read
returns the stale data instead of what the CPU wrote.
The second descriptor's entry probably needs to be invalidated before
the backing page is freed, and it'd be nice to cover a second read
after faultback in the selftest too.
Thanks,
Aveline Noir
next prev parent reply other threads:[~2026-11-22 14:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 4:07 Aveline Noir
2026-11-22 0:00 ` Andrew Morton
2026-11-22 5:55 ` Mika Penttilä
2026-11-22 9:52 ` Andrew Morton
2026-11-22 12:04 ` Mika Penttilä
2026-11-22 14:45 ` Aveline Noir [this message]
2026-11-22 16:32 ` Mika Penttilä
2026-11-22 16:41 ` Mika Penttilä
2026-11-22 17:14 ` Andrew Morton
2026-11-22 17:37 ` Mika Penttilä
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=179535872126.34.4789080961796247940.b4-reply@b4 \
--to=jm5905938@gmail.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=balbirs@nvidia.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=matthew.brost@intel.com \
--cc=mm-commits@vger.kernel.org \
--cc=mpenttil@redhat.com \
--cc=patchwork@emeril.freedesktop.org \
--cc=shuah@kernel.org \
--cc=sj@kernel.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=vbabka@suse.cz \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®