# Re: \[PATCH v23 11/28\] x86/mm: Update pte\_modify for \_PAGE\_COW

- From: Kirill A. Shutemov \<hidden\>
- Date: 2021-03-22 11:32:15 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2021/03/6309989
- Thread: https://ratatoskr.run/linux-doc/2021/03/6303369/t.md

```text
On Tue, Mar 16, 2021 at 08:10:37AM -0700, Yu-cheng Yu wrote:
> The read-only and Dirty PTE has been used to indicate copy-on-write pages.
> However, newer x86 processors also regard a read-only and Dirty PTE as a
> shadow stack page.  In order to separate the two, the software-defined
> _PAGE_COW is created to replace _PAGE_DIRTY for the copy-on-write case, and
> pte_*() are updated.
> 
> Pte_modify() changes a PTE to 'newprot', but it doesn't use the pte_*().
> Introduce fixup_dirty_pte(), which sets a dirty PTE, based on _PAGE_RW,
> to either _PAGE_DIRTY or _PAGE_COW.
> 
> Apply the same changes to pmd_modify().
> 
> Signed-off-by: Yu-cheng Yu <redacted>

Reviewed-by: Kirill A. Shutemov <redacted>

-- 
 Kirill A. Shutemov
```
