don't use vmemmap_populate() to initialize shadow
Subsystems (5)
cover don't use vmemmap_populate() to initialize shadow
Andrey Ryabinin asked to replace the three patches in my series:
x86-kasan-add-and-use-kasan_map_populate.patch arm64-kasan-add-and-use-kasan_map_populate.patch arm64-kasan-avoid-using-vmemmap_populate-to-initialise-shadow.patch
With two patches in this thread:
x86/mm/kasan: don't use vmemmap_populate() to initialize shadow arm64/mm/kasan: don't use vmemmap_populate() to initialize shadow
Pavel Tatashin (2):
x86/mm/kasan: don't use vmemmap_populate() to initialize shadow arm64/mm/kasan: don't use vmemmap_populate() to initialize shadow
arch/arm64/Kconfig | 2 +- arch/arm64/mm/kasan_init.c | 130 ++++++++++++++++++++++++---------------- arch/x86/Kconfig | 2 +- arch/x86/mm/kasan_init_64.c | 143 +++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 218 insertions(+), 59 deletions(-)
Signature · 1 line
2.15.0
PATCH 1/2 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.
--- arch/x86/Kconfig | 2 +- arch/x86/mm/kasan_init_64.c | 143 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 137 insertions(+), 8 deletions(-)
arch/x86/Kconfig +1 -1
@@ -108,7 +108,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_KMEMCHECK select HAVE_ARCH_MMAP_RND_BITS if MMU
arch/x86/mm/kasan_init_64.c +136 -7
178 lines not on this page · raw message
Signature · 1 line
2.15.0
tip-bot for Andrey Ryabinin
merge bot[tip:x86/urgent] x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
Commit-ID: f68d62a56708b0c19dca7a998f408510f2fbc3a8 Gitweb: https://git.kernel.org/tip/f68d62a56708b0c19dca7a998f408510f2fbc3a8 Author: Andrey Ryabinin <[email protected]> AuthorDate: Wed, 15 Nov 2017 17:36:35 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 22 Nov 2017 07:18:35 +0100
x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
[ Note, this commit is a cherry-picked version of:
d17a1d97dc20: ("x86/mm/kasan: don't use vmemmap_populate() to initialize shadow")... for easier x86 entry code testing and back-porting. ]
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.
--- arch/x86/Kconfig | 2 +- arch/x86/mm/kasan_init_64.c | 143 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 137 insertions(+), 8 deletions(-)
arch/x86/Kconfig +1 -1
@@ -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_KMEMCHECK select HAVE_ARCH_MMAP_RND_BITS if MMU
arch/x86/mm/kasan_init_64.c +136 -7
178 lines not on this page · raw message
Andy Lutomirski
maintainerRe: [tip:x86/urgent] x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
Quoted 7 lines · tip-bot for Andrey Ryabinin
Commit-ID: f68d62a56708b0c19dca7a998f408510f2fbc3a8 Gitweb: https://git.kernel.org/tip/f68d62a56708b0c19dca7a998f408510f2fbc3a8 Author: Andrey Ryabinin <[email protected]> AuthorDate: Wed, 15 Nov 2017 17:36:35 -0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 22 Nov 2017 07:18:35 +0100
Quoted 7 lines
x86/mm/kasan: Don't use
vmemmap_populate()to initialize shadow[ Note, this commit is a cherry-picked version of:
d17a1d97dc20: ("x86/mm/kasan: don't use vmemmap_populate() to initialize shadow")... for easier x86 entry code testing and back-porting. ]
I'm confused. Isn't this patch already in Linus' tree, merged in (I think) 7c225c69f86c934e3be9be63ecde754e286838d7?
PATCH 2/2 arm64/mm/kasan: don't use vmemmap_populate() to initialize shadow
In reply to Pavel TatashinThe 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.
--- arch/arm64/Kconfig | 2 +- arch/arm64/mm/kasan_init.c | 130 ++++++++++++++++++++++++++++----------------- 2 files changed, 81 insertions(+), 51 deletions(-)
arch/arm64/Kconfig +1 -1
@@ -68,7 +68,7 @@ config ARM64 select HAVE_ARCH_BITREVERSE select HAVE_ARCH_HUGE_VMAP select HAVE_ARCH_JUMP_LABEL - select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP && !(ARM64_16K_PAGES && ARM64_VA_BITS_48) + select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48) select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
arch/arm64/mm/kasan_init.c +80 -50
199 lines not on this page · raw message
Signature · 1 line
2.15.0