Re: [PATCH v24 15/30] x86/mm: Update maybe_mkwrite() for shadow stack

2021-04-09 Thread Kirill A. Shutemov
On Thu, Apr 01, 2021 at 03:10:49PM -0700, Yu-cheng Yu wrote: > When serving a page fault, maybe_mkwrite() makes a PTE writable if its vma > has VM_WRITE. > > A shadow stack vma has VM_SHADOW_STACK. Its PTEs have _PAGE_DIRTY, but not > _PAGE_WRITE. In fork(), _PAGE_DIRTY is cleared to cause

[PATCH v24 15/30] x86/mm: Update maybe_mkwrite() for shadow stack

2021-04-01 Thread Yu-cheng Yu
When serving a page fault, maybe_mkwrite() makes a PTE writable if its vma has VM_WRITE. A shadow stack vma has VM_SHADOW_STACK. Its PTEs have _PAGE_DIRTY, but not _PAGE_WRITE. In fork(), _PAGE_DIRTY is cleared to cause copy-on-write, and in the page fault handler, _PAGE_DIRTY is restored and