Re: [RFC PATCH 13/37] mm: implement speculative handling in __handle_mm_fault().

From: Andy Lutomirski
Date: Wed Apr 07 2021 - 11:36:42 EST


On 4/6/21 6:44 PM, Michel Lespinasse wrote:
> The page table tree is walked with local irqs disabled, which prevents
> page table reclamation (similarly to what fast GUP does). The logic is
> otherwise similar to the non-speculative path, but with additional
> restrictions: in the speculative path, we do not handle huge pages or
> wiring new pages tables.

Not on most architectures. Quoting the actual comment in mm/gup.c:

> * Before activating this code, please be aware that the following assumptions
> * are currently made:
> *
> * *) Either MMU_GATHER_RCU_TABLE_FREE is enabled, and tlb_remove_table() is used to
> * free pages containing page tables or TLB flushing requires IPI broadcast.

On MMU_GATHER_RCU_TABLE_FREE architectures, you cannot make the
assumption that it is safe to dereference a pointer in a page table just
because irqs are off. You need RCU protection, too.

You have the same error in the cover letter.

--Andy