Re: [RFC PATCH 4/4] x86/mm: write protect (most) page tables

Edgecombe, Rick P
2021-08-23T20:08:46Z

On Mon, 2021-08-23 at 16:25 +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> Allocate page table using __GFP_PTE_MAPPED so that they will have 4K
> PTEs
> in the direct map. This allows to switch _PAGE_RW bit each time a
> page
> table page needs to be made writable or read-only.
>
> The writability of the page tables is toggled only in the lowest
> level page
> table modifiction functions and immediately switched off.
>
> The page tables created early in the boot (including the direct map
> page
> table) are not write protected.
>
> Co-developed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
I have a second version of the PKS tables series that I think gets all
of them.

Also, I didn't see any flush anywhere when toggling. I guess the
spurious kernel fault handler is doing the work? It might be better to
just do a local flush of the address.