From: Zenghui Yu <zenghui.yu@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mm-commits@vger.kernel.org, surenb@google.com, rppt@kernel.org,
mhocko@suse.com, ljs@kernel.org, liam.howlett@oracle.com,
leon@kernel.org, jgg@ziepe.ca, david@kernel.org,
balbirs@nvidia.com, apopple@nvidia.com
Subject: Re: + lib-test_hmm-evict-device-pages-on-file-close-to-avoid-use-after-free.patch added to mm-new branch
Date: Wed, 8 Apr 2026 09:08:41 +0800 [thread overview]
Message-ID: <ebde5bba-8147-40fe-a008-7cffad421637@linux.dev> (raw)
In-Reply-To: <20260401003334.2A85EC19423@smtp.kernel.org>
On 4/1/26 8:33 AM, Andrew Morton wrote:
> The patch titled
> Subject: lib: test_hmm: evict device pages on file close to avoid use-after-free
> has been added to the -mm mm-new branch. Its filename is
> lib-test_hmm-evict-device-pages-on-file-close-to-avoid-use-after-free.patch
>
> This patch will shortly appear at
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-test_hmm-evict-device-pages-on-file-close-to-avoid-use-after-free.patch
>
> This patch will later appear in the mm-new branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Note, mm-new is a provisional staging ground for work-in-progress
> patches, and acceptance into mm-new is a notification for others take
> notice and to finish up reviews. Please do not hesitate to respond to
> review feedback and post updated versions to replace or incrementally
> fixup patches in mm-new.
>
> The mm-new branch of mm.git is not included in linux-next
>
> If a few days of testing in mm-new is successful, the patch will me moved
> into mm.git's mm-unstable branch, which is included in linux-next
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via various
> branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there most days
>
> ------------------------------------------------------
> From: Alistair Popple <apopple@nvidia.com>
> Subject: lib: test_hmm: evict device pages on file close to avoid use-after-free
> Date: Tue, 31 Mar 2026 17:34:43 +1100
>
> Patch series "Minor hmm_test fixes and cleanups".
>
> Two bugfixes a cleanup for the HMM kernel selftests. These were mostly
> reported by Zenghui Yu with special thanks to Lorenzo for analysing and
> pointing out the problems.
>
>
> This patch (of 3):
>
> When dmirror_fops_release() is called it frees the dmirror struct but
> doesn't migrate device private pages back to system memory first. This
> leaves those pages with a dangling zone_device_data pointer to the freed
> dmirror.
>
> If a subsequent fault occurs on those pages (eg. during coredump) the
> dmirror_devmem_fault() callback dereferences the stale pointer causing a
> kernel panic. This was reported [1] when running mm/ksft_hmm.sh on arm64,
> where a test failure triggered SIGABRT and the resulting coredump walked
> the VMAs faulting in the stale device private pages.
>
> Fix this by calling dmirror_device_evict_chunk() for each devmem chunk in
> dmirror_fops_release() to migrate all device private pages back to system
> memory before freeing the dmirror struct. The function is moved earlier
> in the file to avoid a forward declaration.
>
> Link: https://lkml.kernel.org/r/20260331063445.3551404-1-apopple@nvidia.com
> Link: https://lkml.kernel.org/r/20260331063445.3551404-2-apopple@nvidia.com
> Fixes: b2ef9f5a5cb3 ("mm/hmm/test: add selftest driver for HMM")
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> Reported-by: Zenghui Yu <zenghui.yu@linux.dev>
> Closes: https://lore.kernel.org/linux-mm/8bd0396a-8997-4d2e-a13f-5aac033083d7@linux.dev/
> Reviewed-by: Balbir Singh <balbirs@nvidia.com>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Liam Howlett <liam.howlett@oracle.com>
> Cc: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Zenghui Yu <zenghui.yu@linux.dev>
> Cc: <stable@vger,kernel.org>
Cc: <stable@vger.kernel.org>
?
Thanks,
Zenghui
next prev parent reply other threads:[~2026-04-08 1:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 0:33 + lib-test_hmm-evict-device-pages-on-file-close-to-avoid-use-after-free.patch added to mm-new branch Andrew Morton
2026-04-08 1:08 ` Zenghui Yu [this message]
2026-04-08 1:41 ` Andrew Morton
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=ebde5bba-8147-40fe-a008-7cffad421637@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=balbirs@nvidia.com \
--cc=david@kernel.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=liam.howlett@oracle.com \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=surenb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.