[RFC PATCH v4 25/27] mm/mmap: Prevent Shadow Stack VMA merges

From
Yu-cheng Yu <hidden>
Date
2018-09-21 15:11:56
Also in
linux-arch, linux-doc, linux-mm, lkml
Reply to
Yu-cheng Yu, 2018-09-21
Function returns could unwind stacks beyond its allocated area.
We do not merge shadow stack areas.

This and VMA guards prevent shadow stack underflow.

Signed-off-by: Yu-cheng Yu <redacted>
---
 mm/mmap.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c
index de2d0faa1c61..fa581ced3f56 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1123,6 +1123,12 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm,
 	if (vm_flags & VM_SPECIAL)
 		return NULL;
 
+	/*
+	 * Do not merge shadow stack areas.
+	 */
+	if (vm_flags & VM_SHSTK)
+		return NULL;
+
 	if (prev)
 		next = prev->vm_next;
 	else
-- 
2.17.1
Thread (71 messages) 71 messages, 11 authors, last reply 2018-10-16
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