lkml.org 
[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] x86/pti: Call pti_init() after mark_readonly()
Date
From: Joerg Roedel <jroedel@suse.de>

PTI init code clones some parts of the kernel mappings to the user-space
page-table. For the kernel and user-space page-table to be consistent,
the cloning should happen when the relevant parts of the kernel
page-table are finished, which is right after mark_readonly() returns.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
init/main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 3b4ada1..0b5d0f1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -524,8 +524,6 @@ static void __init mm_init(void)
ioremap_huge_init();
/* Should be run before the first non-init thread is created */
init_espfix_bsp();
- /* Should be run after espfix64 is set up. */
- pti_init();
}

asmlinkage __visible void __init start_kernel(void)
@@ -1065,6 +1063,12 @@ static int __ref kernel_init(void *unused)
jump_label_invalidate_initmem();
free_initmem();
mark_readonly();
+ /*
+ * Kernel text/rodata/data sections have the right protections
+ * now. If necessary, init PTI and clone the relevant pieces
+ * to the user-space page-table.
+ */
+ pti_init();
system_state = SYSTEM_RUNNING;
numa_default_policy();

--
2.7.4
\
 
 \ /
  Last update: 2018-07-03 13:53    [W:0.093 / U:2.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site