lkml.org 
[lkml]   [2021]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v25 16/30] mm: Fixup places that call pte_mkwrite() directly
On Thu, Apr 15, 2021 at 03:14:05PM -0700, Yu-cheng Yu wrote:
> When serving a page fault, maybe_mkwrite() makes a PTE writable if it is in
> a writable vma. A shadow stack vma is writable, but its PTEs need
> _PAGE_DIRTY to be set to become writable. For this reason, maybe_mkwrite()
> has been updated.
>
> There are a few places that call pte_mkwrite() directly, but have the
> same result as from maybe_mkwrite(). These sites need to be updated for
> shadow stack as well. Thus, change them to maybe_mkwrite():
>
> - do_anonymous_page() and migrate_vma_insert_page() check VM_WRITE directly
> and call pte_mkwrite(), which is the same as maybe_mkwrite(). Change
> them to maybe_mkwrite().
>
> - In do_numa_page(), if the numa entry was writable, then pte_mkwrite()
> is called directly. Fix it by doing maybe_mkwrite(). Make the same
> changes to do_huge_pmd_numa_page().
>
> - In change_pte_range(), pte_mkwrite() is called directly. Replace it with
> maybe_mkwrite().
>
> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
> Cc: Kees Cook <keescook@chromium.org>

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

--
Kirill A. Shutemov

\
 
 \ /
  Last update: 2021-04-23 12:15    [W:0.576 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site