lkml.org 
[lkml]   [2018]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 08/10] mm: Prevent mremap of shadow stack
Date
Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
---
mm/mremap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/mremap.c b/mm/mremap.c
index 049470aa1e3e..70f20edb248e 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -525,7 +525,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
unsigned long, new_addr)
{
struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
+ struct vm_area_struct *vma = find_vma(mm, addr);
unsigned long ret = -EINVAL;
unsigned long charged = 0;
bool locked = false;
@@ -533,6 +533,9 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
LIST_HEAD(uf_unmap_early);
LIST_HEAD(uf_unmap);

+ if (vma->vm_flags & VM_SHSTK)
+ return ret;
+
if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE))
return ret;

--
2.15.1
\
 
 \ /
  Last update: 2018-06-07 17:39    [W:0.281 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site