* [PATCH] mm/migrate: untag addresses when querying page nodes
@ 2026-10-25 22:32 Hungyu Lin
2026-10-26 2:11 ` Zi Yan
0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-10-25 22:32 UTC (permalink / raw)
To: akpm, david
Cc: ziy, matthew.brost, joshua.hahnjy, byungchul, gourry, ying.huang,
apopple, andreyknvl, catalin.marinas, vincenzo.frascino,
khalid.aziz, odys.yuan, sashiko-bot, linux-mm, linux-kernel,
stable, Hungyu Lin
When move_pages() is used with nodes == NULL, do_pages_stat_array()
passes each page address directly to vma_lookup(). A valid tagged address
therefore fails the VMA lookup and gets -EFAULT in its status entry,
instead of the node reported for the corresponding untagged address.
The tagged address ABI permits these pointers, and the migration path
already removes their tags. Apply the target mm's untagging rules to
the query path as well, while holding its mmap read lock.
Fixes: 057d3389108e ("mm: untag user pointers passed to memory syscalls")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/r/20260721183257.706661F000E9@smtp.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 7e3a81f06974..994c78782a54 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2461,7 +2461,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
mmap_read_lock(mm);
for (i = 0; i < nr_pages; i++) {
- unsigned long addr = (unsigned long)(*pages);
+ unsigned long addr = (unsigned long)untagged_addr_remote(mm, *pages);
struct vm_area_struct *vma;
struct folio_walk fw;
struct folio *folio;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/migrate: untag addresses when querying page nodes
2026-10-25 22:32 [PATCH] mm/migrate: untag addresses when querying page nodes Hungyu Lin
@ 2026-10-26 2:11 ` Zi Yan
0 siblings, 0 replies; 2+ messages in thread
From: Zi Yan @ 2026-10-26 2:11 UTC (permalink / raw)
To: Hungyu Lin, akpm, david
Cc: matthew.brost, joshua.hahnjy, byungchul, gourry, ying.huang,
apopple, andreyknvl, catalin.marinas, vincenzo.frascino,
khalid.aziz, odys.yuan, sashiko-bot, linux-mm, linux-kernel,
stable
On Sun Oct 25, 2026 at 6:32 PM EDT, Hungyu Lin wrote:
> When move_pages() is used with nodes == NULL, do_pages_stat_array()
> passes each page address directly to vma_lookup(). A valid tagged address
> therefore fails the VMA lookup and gets -EFAULT in its status entry,
> instead of the node reported for the corresponding untagged address.
>
> The tagged address ABI permits these pointers, and the migration path
> already removes their tags. Apply the target mm's untagging rules to
> the query path as well, while holding its mmap read lock.
>
> Fixes: 057d3389108e ("mm: untag user pointers passed to memory syscalls")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://lore.kernel.org/r/20260721183257.706661F000E9@smtp.kernel.org
It should be "Closes:"
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> mm/migrate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 7e3a81f06974..994c78782a54 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -2461,7 +2461,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
> mmap_read_lock(mm);
>
> for (i = 0; i < nr_pages; i++) {
> - unsigned long addr = (unsigned long)(*pages);
> + unsigned long addr = (unsigned long)untagged_addr_remote(mm, *pages);
> struct vm_area_struct *vma;
> struct folio_walk fw;
> struct folio *folio;
LGTM. add_folio_for_migration() does the same thing for user pointer p.
Acked-by: Zi Yan <ziy@nvidia.com>
--
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-26 2:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 22:32 [PATCH] mm/migrate: untag addresses when querying page nodes Hungyu Lin
2026-10-26 2:11 ` Zi Yan
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®