lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 2/3] x86/mm/pti: issue warning when mapping large pmd beyond specifid range
Date
From: Lai Jiangshan <laijs@linux.alibaba.com>

When PTI_CLONE_PTE, the caller doesn't want to expose pages beyond specifid
range and it worths a warning.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
arch/x86/mm/pti.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 7ee99ef13a99..cd6da1d42ba9 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -356,6 +356,13 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
* caller, so we just simply align it here.
*/
addr = round_down(addr, PMD_SIZE);
+ /*
+ * Mapping large pmd beyond [start, end) may expose
+ * secrets to user-space when it wants to clone ptes
+ * only.
+ */
+ WARN_ON_ONCE(level == PTI_CLONE_PTE &&
+ (addr < start || end < addr + PMD_SIZE));

target_pmd = pti_user_pagetable_walk_pmd(addr);
if (WARN_ON(!target_pmd))
--
2.19.1.6.gb485710b
\
 
 \ /
  Last update: 2020-12-10 14:41    [W:0.192 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site