Re: [PATCH v3 4/9] mm/migrate: warn on a writable migration entry with the uffd bit set

From: Mike Rapoport

Date: Wed Nov 18 2026 - 09:37:32 EST


On Tue, Nov 17, 2026 at 11:28:44PM -0500, Tal Zussman wrote:
> A writable migration entry must not have the uffd bit set. Every path
> that sets the bit on a migration entry makes the entry read-only first.
> PAGEMAP_SCAN was the one path that did not, and it now does as well.
>
> remove_migration_pte() restores such an entry writable and drops the
> uffd bit, while remove_migration_pmd() sets the bit and write-protects
> the PMD.
>
> Warn in both paths on a writable entry with the uffd bit set. Also make
> the PMD path only set the uffd bit for a read-only entry, like the PTE
> path, so that the two behave the same, as this should never happen.
>
> Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>

Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

> ---
> mm/huge_memory.c | 7 +++++--
> mm/migrate.c | 7 +++++--
> 2 files changed, 10 insertions(+), 4 deletions(-)

--
Sincerely yours,
Mike.