Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603591

[PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h>

From "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h>
Date 2017-03-17 20:50 +0100
Message-ID <tm62S-2ZV-21@gated-at.bofh.it> (permalink)
References <tm5gu-2nQ-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


With folded p4d, pgd_clear() is nop. Change clear_pgds() to use
p4d_clear() instead.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
---
 arch/x86/mm/kasan_init_64.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index 0a56059a95c7..b775ffd7989d 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -35,8 +35,19 @@ static int __init map_range(struct range *range)
 static void __init clear_pgds(unsigned long start,
 			unsigned long end)
 {
-	for (; start < end; start += PGDIR_SIZE)
-		pgd_clear(pgd_offset_k(start));
+	pgd_t *pgd;
+
+	for (; start < end; start += PGDIR_SIZE) {
+		pgd = pgd_offset_k(start);
+		/*
+		 * With folded p4d, pgd_clear() is nop, use p4d_clear()
+		 * instead.
+		 */
+		if (CONFIG_PGTABLE_LEVELS < 5)
+			p4d_clear(p4d_offset(pgd, start));
+		else
+			pgd_clear(pgd);
+	}
 }
 
 static void __init kasan_map_early_shadow(pgd_t *pgd)
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] x86: 5-level paging enabling for v4.12, Part 2 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
  [PATCH 6/6] x86: Convert the rest of the code to support p4d_t "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
    [tip:x86/mm] x86: Convert the rest of the code to support p4d_t "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
  [PATCH 2/6] x86/efi: Add 5-level paging support "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
    [tip:x86/mm] x86/efi: Add 5-level paging support "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
  [PATCH 1/6] x86/kexec: Add 5-level paging support "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
    [tip:x86/mm] x86/kexec: Add 5-level paging support "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
  [PATCH 5/6] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap() to support p4d "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
    Re: [PATCH 5/6] x86/xen: Change __xen_pgd_walk() and  xen_cleanmfnmap() to support p4d Ingo Molnar <mingo@kernel.org> - 2017-03-27 08:40 +0200
      Re: [PATCH 5/6] x86/xen: Change __xen_pgd_walk() and  xen_cleanmfnmap() to support p4d "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-27 15:20 +0200
    [tip:x86/mm] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap()  to support p4d tip-bot for Xiong Zhang <tipbot@zytor.com> - 2017-03-27 12:40 +0200
  [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:50 +0100
    Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to  <asm-generic/pgtable-nop4d.h> Ingo Molnar <mingo@kernel.org> - 2017-03-22 08:40 +0100
      Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to  <asm-generic/pgtable-nop4d.h> "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-24 10:10 +0100
        Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to  <asm-generic/pgtable-nop4d.h> Ingo Molnar <mingo@kernel.org> - 2017-03-24 12:00 +0100
    [tip:x86/mm] x86/kasan: Prepare clear_pgds() to switch to  <asm-generic/pgtable-nop4d.h> "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200

csiph-web