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

2021-03-22 Thread Kirill A. Shutemov
On Tue, Mar 16, 2021 at 08:10:41AM -0700, Yu-cheng Yu wrote: > diff --git a/include/linux/mm.h b/include/linux/mm.h > index a6c18c5752d6..af805ffde48e 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -997,6 +997,8 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct > vm_area_st

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

2021-03-17 Thread Borislav Petkov
On Tue, Mar 16, 2021 at 08:10:41AM -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_SHSTK. Its PTEs have _PAGE_DIRTY, but not > _PAGE_WRITE. In fork(), _PAGE_DIRTY is cleared to effect copy-on-wri

[PATCH v23 15/28] x86/mm: Update maybe_mkwrite() for shadow stack

2021-03-16 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_SHSTK. Its PTEs have _PAGE_DIRTY, but not _PAGE_WRITE. In fork(), _PAGE_DIRTY is cleared to effect copy-on-write, and in page fault, _PAGE_DIRTY is restored and the shadow stack pag