Re: [PATCH v5 0/7] mm/mprotect: Fix dax puds

From: Jann Horn
Date: Mon Nov 11 2024 - 16:21:47 EST


On Mon, Aug 12, 2024 at 8:12 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
> Dax supports pud pages for a while, but mprotect on puds was missing since
> the start. This series tries to fix that by providing pud handling in
> mprotect(). The goal is to add more types of pud mappings like hugetlb or
> pfnmaps. This series paves way for it by fixing known pud entries.

Do people actually use hardware where they can use PUD THP mappings
for DAX? I thought that was just some esoteric feature that isn't
actually usable on almost any system.
Was I wrong about that?

I think another example that probably doesn't play entirely nice with
PUD THP mappings is mremap()'s move_page_tables(). If
dax_get_unmapped_area() allows creating a VMA at an unaligned start
address (which I think it does?), move_page_tables() can probably end
up copying from an aligned address mapped with a huge PUD entry to an
unaligned address that needs to be mapped at the PTE level, and I
think that will probably cause it to call into get_old_pmd() while a
huge PUD entry is still present, which will probably get us a
pud_bad() error or such?