Re: [PATCH v23 16/28] mm: Fixup places that call pte_mkwrite() directly
From: Borislav Petkov <bp@alien8.de>
Date: 2021-03-18 09:48:32
Also in:
linux-arch, linux-doc, linux-mm, lkml
From: Borislav Petkov <bp@alien8.de>
Date: 2021-03-18 09:48:32
Also in:
linux-arch, linux-doc, linux-mm, lkml
On Tue, Mar 16, 2021 at 08:10:42AM -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 effect the same result as from maybe_mkwrite(). These sites need to be updated for
s/effect the same result/have the same result/
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()
You can simply say "was writable" instead of trying to hint at the variable there.
is called directly. Fix it by doing maybe_mkwrite(). - In change_pte_range(), pte_mkwrite() is called directly. Replace it with maybe_mkwrite(). A shadow stack vma is writable but has different vma flags, and handled accordingly in maybe_mkwrite(). Signed-off-by: Yu-cheng Yu <redacted> Reviewed-by: Kees Cook <redacted> --- mm/memory.c | 5 ++--- mm/migrate.c | 3 +-- mm/mprotect.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
As with the previous one, I guess this one needs a mm person ACK. I
mean, it is pretty obvious but still...
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette