Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,ziy@nvidia.com,vbabka@kernel.org,
	thomas.hellstrom@linux.intel.com,stable@vger.kernel.org,sj@kernel.org,
	patchwork@emeril.freedesktop.org,mpenttil@redhat.com,matthew.brost@intel.com,
	ljs@kernel.org,leon@kernel.org,jgg@ziepe.ca,francois.dugast@intel.com,
	christian.koenig@amd.com,balbirs@nvidia.com,apopple@nvidia.com,
	akpm@linux-foundation.org,airlied@gmail.com,jm5905938@gmail.com
Subject: + mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch added to mm-hotfixes-unstable branch
Date: Sat, 21 Nov 2026 16:01:52 -0800	[thread overview]
Message-ID: <20261122000152.DD16D1F000CF@smtp.kernel.org> (raw)
In-Reply-To: <179342234355.4.16705453209886955762@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5304 bytes --]


The patch titled
     Subject: mm/hmm: account for subpage offsets in device-private PMDs
has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
     mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch

This patch will later appear in the mm-hotfixes-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

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: Aveline Noir <jm5905938@gmail.com>
Subject: mm/hmm: account for subpage offsets in device-private PMDs
Date: Sat, 31 Oct 2026 15:07:58 +1100

When a query starts inside a device-private PMD owned by
range->dev_private_owner, hmm_vma_handle_absent_pmd() still fills the PFN
array from the folio's first page.  The returned PFNs therefore refer to
earlier pages rather than the requested subrange.

Nouveau's GPU fault path can query one page of a device-private PMD at a
time.  Xe's SVM fault, prefetch and userptr mapping paths can also query
subranges of their own device-private PMDs.  An unprivileged process with
access to the GPU render node can reach these paths on hardware supporting
device-private THP migration.  Xe can read the wrong application data or
silently overwrite earlier pages of the same process's device-private
folio.

Nouveau aligns a one-page GPU fault to the PMD head by subtracting the
fault offset from the returned page.  The faulty HMM PFN already refers to
the head, so this subtraction can select a page before the folio.  If the
preceding page belongs to another allocation, GPU access can expose or
overwrite unrelated userspace data; an invalid page can also fault the
kernel during its address conversion.  This worst case follows from the
source, but has not been demonstrated on a real GPU.

Add the query's PMD-relative page offset to the initial PFN, as the
present PMD path already does.

The device-private PMD migration machinery first shipped in 6.19. 
Backport this fix to the maintained 7.3.y stable series; the HMM path
exists in 6.18.y but cannot be reached through an in-tree PMD-producing
device-private migration path there.

Link: https://patch.msgid.link/179342234355.4.16705453209886955762@gmail.com
Fixes: 10b9feee2d0d ("mm/hmm: populate PFNs from PMD swap entry")
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Tested-by: Andrew Morton <akpm@linux-foundation.org>
  Link: https://lore.kernel.org/20261121160037.1a479f3c8b4e860bc23c106d@linux-foundation.org
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Patchwork <patchwork@emeril.freedesktop.org>
Cc: SJ Park <sj@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Balbir Singh <balbirs@nvidia.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Mika Penttilä <mpenttil@redhat.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>

 mm/hmm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mm/hmm.c~mm-hmm-account-for-subpage-offsets-in-device-private-pmds
+++ a/mm/hmm.c
@@ -355,7 +355,8 @@ static int hmm_vma_handle_absent_pmd(str
 	    range->dev_private_owner) {
 		unsigned long cpu_flags = HMM_PFN_VALID |
 			hmm_pfn_flags_order(PMD_SHIFT - PAGE_SHIFT);
-		unsigned long pfn = softleaf_to_pfn(entry);
+		unsigned long pfn = softleaf_to_pfn(entry) +
+			((start & ~PMD_MASK) >> PAGE_SHIFT);
 		unsigned long i;
 
 		if (softleaf_is_device_private_write(entry))
_

Patches currently in -mm which might be from jm5905938@gmail.com are

mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch
mm-damon-ops-common-align-mmu-notifier-range-when-clearing-pmd-young-bit.patch
mm-damon-stat-avoid-32-bit-overflow-in-idle-percentiles.patch
mm-damon-pvaddr-skip-folios-already-on-the-migration-target-node.patch
docs-admin-guide-mm-damon-start-fix-grammar.patch
docs-admin-guide-mm-damon-stat-fix-pronoun-agreement.patch
docs-admin-guide-mm-damon-usage-fix-grammar.patch
docs-admin-guide-mm-damon-lru_sort-fix-remaining-grammar.patch
docs-mm-damon-design-fix-grammar-and-typos.patch
docs-mm-damon-api-fix-verb-form.patch
docs-mm-damon-maintainer-profile-fix-subject-verb-agreement.patch
docs-mm-damon-monitoring_intervals_tuning_example-fix-grammar-and-typos.patch
mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion.patch
mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion-fix.patch


           reply	other threads:[~2026-11-22  0:01 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <179342234355.4.16705453209886955762@gmail.com>]

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=20261122000152.DD16D1F000CF@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=airlied@gmail.com \
    --cc=apopple@nvidia.com \
    --cc=balbirs@nvidia.com \
    --cc=christian.koenig@amd.com \
    --cc=francois.dugast@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jm5905938@gmail.com \
    --cc=leon@kernel.org \
    --cc=ljs@kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=mpenttil@redhat.com \
    --cc=patchwork@emeril.freedesktop.org \
    --cc=sj@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=vbabka@kernel.org \
    --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