Skip to contentSkip to conversation

x86/mm/kasan: don't use vmemmap_populate() to initialize shadow

PATCH New [email protected] 1 participant 1 message Nov 16, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 87/131 x86/mm/kasan: don't use vmemmap_populate() to initialize shadow

From: Andrey Ryabinin <[email protected]>
Subject: x86/mm/kasan: don't use vmemmap_populate() to initialize shadow

The kasan shadow is currently mapped using vmemmap_populate() since that provides a semi-convenient way to map pages into init_top_pgt. However, since that no longer zeroes the mapped pages, it is not suitable for kasan, which requires zeroed shadow memory.

Add kasan_populate_shadow() interface and use it instead of vmemmap_populate(). Besides, this allows us to take advantage of gigantic pages and use them to populate the shadow, which should save us some memory wasted on page tables and reduce TLB pressure.

Cc Steven Sistare <[email protected]>
Cc Daniel Jordan <[email protected]>
Cc Bob Picco <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc David S. Miller <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Will Deacon <[email protected]>

---

 arch/x86/Kconfig            |    2 
 arch/x86/mm/kasan_init_64.c |  143 ++++++++++++++++++++++++++++++++--
 2 files changed, 137 insertions(+), 8 deletions(-)
arch/x86/Kconfig renamed from arch/x86/Kconfig~x86-mm-kasan-dont-use-vmemmap_populate-to-initialize-shadow +1 -1
diff -puN arch/x86/Kconfig~x86-mm-kasan-dont-use-vmemmap_populate-to-initialize-shadow arch/x86/Kconfig
@@ -110,7 +110,7 @@ config X86
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_HUGE_VMAP		if X86_64 || X86_PAE
 	select HAVE_ARCH_JUMP_LABEL
-	select HAVE_ARCH_KASAN			if X86_64 && SPARSEMEM_VMEMMAP
+	select HAVE_ARCH_KASAN			if X86_64
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_MMAP_RND_BITS		if MMU
 	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if MMU && COMPAT
arch/x86/mm/kasan_init_64.c renamed from arch/x86/mm/kasan_init_64.c~x86-mm-kasan-dont-use-vmemmap_populate-to-initialize-shadow +136 -7

178 lines not on this page · raw message

_