From: Joerg Roedel <[email protected]>

The pti_init() function is now called late enough for
pti_clone_kernel_text(), so call it directly from there.

Signed-off-by: Joerg Roedel <[email protected]>
---
 arch/x86/include/asm/pti.h | 2 --
 arch/x86/mm/init_64.c      | 6 ------
 arch/x86/mm/pti.c          | 3 ++-
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/pti.h b/arch/x86/include/asm/pti.h
index 38a17f1..0b5ef05 100644
--- a/arch/x86/include/asm/pti.h
+++ b/arch/x86/include/asm/pti.h
@@ -6,10 +6,8 @@
 #ifdef CONFIG_PAGE_TABLE_ISOLATION
 extern void pti_init(void);
 extern void pti_check_boottime_disable(void);
-extern void pti_clone_kernel_text(void);
 #else
 static inline void pti_check_boottime_disable(void) { }
-static inline void pti_clone_kernel_text(void) { }
 #endif
 
 #endif /* __ASSEMBLY__ */
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a688617..9b19f9a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1291,12 +1291,6 @@ void mark_rodata_ro(void)
                        (unsigned long) __va(__pa_symbol(_sdata)));
 
        debug_checkwx();
-
-       /*
-        * Do this after all of the manipulation of the
-        * kernel text page tables are complete.
-        */
-       pti_clone_kernel_text();
 }
 
 int kern_addr_valid(unsigned long addr)
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 8a80522..dd344f7 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -438,7 +438,7 @@ static inline bool pti_kernel_image_global_ok(void)
  * For some configurations, map all of kernel text into the user page
  * tables.  This reduces TLB misses, especially on non-PCID systems.
  */
-void pti_clone_kernel_text(void)
+static void pti_clone_kernel_text(void)
 {
        /*
         * rodata is part of the kernel image and is normally
@@ -499,6 +499,7 @@ void pti_init(void)
        pti_set_kernel_image_nonglobal();
        /* Replace some of the global bits just for shared entry text: */
        pti_clone_entry_text();
+       pti_clone_kernel_text();
        pti_setup_espfix64();
        pti_setup_vsyscall();
 }
-- 
2.7.4

Reply via email to