Skip to contentSkip to conversation

Patch "x86/kasan: Flush TLBs after switching CR3" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Aug 7, 2015

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

x86/kasan: Flush TLBs after switching CR3

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
x86-kasan-flush-tlbs-after-switching-cr3.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 241d2c54c62fa0939fc9a9512b48ac3434e90a89 Mon Sep 17 00:00:00 2001

From: Andrey Ryabinin <[email protected]>
Date: Thu, 2 Jul 2015 12:09:35 +0300
Subject: x86/kasan: Flush TLBs after switching CR3

From: Andrey Ryabinin <[email protected]>

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.

Cc Alexander Popov <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Andrey Konovalov <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/mm/kasan_init_64.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/mm/kasan_init_64.c +2 -0
@@ -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;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/x86-kasan-fix-kasan-shadow-region-page-tables.patch queue-4.1/x86-kasan-fix-boot-crash-on-amd-processors.patch queue-4.1/x86-init-clear-init_level4_pgt-earlier.patch queue-4.1/x86-kasan-flush-tlbs-after-switching-cr3.patch