[Devel] [PATCH RHEL7 COMMIT] ms/x86/init: Clear 'init_level4_pgt' earlier

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 3 08:27:49 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.6
------>
commit 2c3d4203ed393d91ba79a0fa59f5e1ce5fe7627a
Author: Andrey Ryabinin <aryabinin at odin.com>
Date:   Thu Sep 3 19:27:49 2015 +0400

    ms/x86/init: Clear 'init_level4_pgt' earlier
    
    https://jira.sw.ru/browse/PSBM-26429
    
    From: Andrey Ryabinin <a.ryabinin at samsung.com>
    
    commit d0f77d4d04b222a817925d33ba3589b190bfa863 upstream.
    
    Currently x86_64_start_kernel() has two KASAN related
    function calls. The first call maps shadow to early_level4_pgt,
    the second maps shadow to init_level4_pgt.
    
    If we move clear_page(init_level4_pgt) earlier, we could hide
    KASAN low level detail from generic x86_64 initialization code.
    The next patch will do it.
    
    Signed-off-by: Andrey Ryabinin <a.ryabinin at samsung.com>
    Cc: <stable at vger.kernel.org> # 4.0+
    Cc: Alexander Popov <alpopov at ptsecurity.com>
    Cc: Alexander Potapenko <glider at google.com>
    Cc: Andrey Konovalov <adech.fo at gmail.com>
    Cc: Borislav Petkov <bp at alien8.de>
    Cc: Dmitry Vyukov <dvyukov at google.com>
    Cc: Linus Torvalds <torvalds at linux-foundation.org>
    Cc: Peter Zijlstra <peterz at infradead.org>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Link: http://lkml.kernel.org/r/1435828178-10975-2-git-send-email-a.ryabinin@samsung.com
    Signed-off-by: Ingo Molnar <mingo at kernel.org>
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
    
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
---
 arch/x86/kernel/head64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 67df086..357ce8a 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -164,6 +164,8 @@ void __init x86_64_start_kernel(char * real_mode_data)
 	/* clear bss before set_intr_gate with early_idt_handler */
 	clear_bss();
 
+	clear_page(init_level4_pgt);
+
 	for (i = 0; i < NUM_EXCEPTION_VECTORS; i++)
 		set_intr_gate(i, early_idt_handlers[i]);
 	load_idt((const struct desc_ptr *)&idt_descr);
@@ -178,7 +180,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
 	if (console_loglevel == 10)
 		early_printk("Kernel alive\n");
 
-	clear_page(init_level4_pgt);
 	/* set init_level4_pgt kernel high mapping*/
 	init_level4_pgt[511] = early_level4_pgt[511];
 



More information about the Devel mailing list