Re: [PATCH v3] mm/migrate: Fix do_pages_stat in 32-bit mode

From: Christoph Berg
Date: Thu Jul 03 2025 - 13:40:07 EST


Re: David Hildenbrand
> > For arrays with more than 16 entries, the old code would incorrectly
> > advance the pages pointer by 16 words instead of 16 compat_uptr_t.
> > Fix by doing the pointer arithmetic inside get_compat_pages_array where
> > pages32 is already a correctly-typed pointer.
> >
> > Discovered while working on PostgreSQL 18's new NUMA introspection code.
> >
> > Signed-off-by: Christoph Berg <myon@xxxxxxxxxx>
> > Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> > Fixes: 5b1b561ba73c ("mm: simplify compat_sys_move_pages")
>
> Hmm, still not sure if 5b1b561ba73c really introduced the issue. I think it
> only messed with the "pages" pointer, not with the "status" pointer?

"pages" was the broken one. "status" isn't affected by compat mode.

> Acked-by: David Hildenbrand <david@xxxxxxxxxx>

Thanks!

Christoph