Re: [PATCH v1] x86/mm/pat: fix VM_PAT handling in COW mappings

From: Matthew Wilcox
Date: Tue Mar 12 2024 - 15:23:13 EST


On Tue, Mar 12, 2024 at 07:11:18PM +0100, David Hildenbrand wrote:
> PAT handling won't do the right thing in COW mappings: the first PTE
> (or, in fact, all PTEs) can be replaced during write faults to point at
> anon folios. Reliably recovering the correct PFN and cachemode using
> follow_phys() from PTEs will not work in COW mappings.

I guess the first question is: Why do we want to support COW mappings
of VM_PAT areas? What breaks if we just disallow it?