Thread (67 messages) 67 messages, 5 authors, 2021-02-08

Re: [PATCH v19 14/25] x86/mm: Update maybe_mkwrite() for shadow stack

From: Kees Cook <hidden>
Date: 2021-02-04 20:23:20
Also in: linux-api, linux-arch, linux-mm, lkml

On Wed, Feb 03, 2021 at 02:55:36PM -0800, 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-write,
and in page fault, _PAGE_DIRTY is restored and the shadow stack page is
writable again.

Update maybe_mkwrite() by introducing arch_maybe_mkwrite(), which sets
_PAGE_DIRTY for a shadow stack PTE.

Apply the same changes to maybe_pmd_mkwrite().

Signed-off-by: Yu-cheng Yu <redacted>
Reviewed-by: Kees Cook <redacted>

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help