Re: [PATCH v4 21/39] mm/mprotect: Exclude shadow stack from preserve_write
From: Kees Cook <hidden>
Date: 2022-12-03 02:38:39
Also in:
linux-arch, linux-doc, linux-mm, lkml
From: Kees Cook <hidden>
Date: 2022-12-03 02:38:39
Also in:
linux-arch, linux-doc, linux-mm, lkml
On Fri, Dec 02, 2022 at 04:35:48PM -0800, Rick Edgecombe wrote:
From: Yu-cheng Yu <redacted> The x86 Control-flow Enforcement Technology (CET) feature includes a new type of memory called shadow stack. This shadow stack memory has some unusual properties, which requires some core mm changes to function properly. In change_pte_range(), when a PTE is changed for prot_numa, _PAGE_RW is preserved to avoid the additional write fault after the NUMA hinting fault. However, pte_write() now includes both normal writable and shadow stack (Write=0, Dirty=1) PTEs, but the latter does not have _PAGE_RW and has no need to preserve it. Exclude shadow stack from preserve_write test, and apply the same change to change_huge_pmd(). Tested-by: Pengfei Xu <redacted> Tested-by: John Allen <john.allen@amd.com> Signed-off-by: Yu-cheng Yu <redacted>
Reviewed-by: Kees Cook <redacted> -- Kees Cook