[Devel] [PATCH RHEL7 COMMIT] ms/x86/kasan: Flush TLBs after switching CR3

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 3 08:27:51 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 f1796a8d4debf66ae569701aeaf5e739661808c2
Author: Andrey Ryabinin <aryabinin at odin.com>
Date:   Thu Sep 3 19:27:51 2015 +0400

    ms/x86/kasan: Flush TLBs after switching CR3
    
    https://jira.sw.ru/browse/PSBM-26429
    
    From: Andrey Ryabinin <a.ryabinin at samsung.com>
    
    commit 241d2c54c62fa0939fc9a9512b48ac3434e90a89 upstream.
    
    load_cr3() doesn't cause tlb_flush if PGE enabled.
    
    This may cause tons of false positive reports spamming the
    kernel to death.
    
    To fix this __flush_tlb_all() should be called explicitly
    after CR3 changed.
    
    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-4-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/mm/kasan_init_64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index ad0b931..0ada6cc 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -208,6 +208,7 @@ void __init kasan_init(void)
 
 	memcpy(early_level4_pgt, init_level4_pgt, sizeof(early_level4_pgt));
 	load_cr3(early_level4_pgt);
+	__flush_tlb_all();
 
 	clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END);
 
@@ -234,5 +235,6 @@ void __init kasan_init(void)
 	memset(kasan_zero_page, 0, PAGE_SIZE);
 
 	load_cr3(init_level4_pgt);
+	__flush_tlb_all();
 	init_task.kasan_depth = 0;
 }



More information about the Devel mailing list