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

From
Kirill A. Shutemov <hidden>
Date
2021-03-22 10:47:16
Also in
linux-api, linux-arch, linux-mm, lkml
Reply to
Yu-cheng Yu, 2021-03-16
On Tue, Mar 16, 2021 at 08:10:41AM -0700, Yu-cheng Yu wrote:
quoted hunk ↗ jump to hunk
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_struct *vma)
 {
 	if (likely(vma->vm_flags & VM_WRITE))
 		pte = pte_mkwrite(pte);
+	else
+		pte = arch_maybe_mkwrite(pte, vma);
 	return pte;
 }
I think it would be cleaner to allow arch code to override maybe_mkwrite()
and maybe_pmd_mkwrite() altogether. Wrap it into #ifndef maybe_mkwrite
here and provide VM_SHSTK-aware version from <asm/pgtable.h>.

-- 
 Kirill A. Shutemov
Thread (66 messages) 66 messages, 5 authors, last reply 2021-03-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help