[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1494897409-14408-4-git-send-email-iamjoonsoo.kim@lge.com>
Date: Tue, 16 May 2017 10:16:41 +0900
From: js1304@...il.com
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, kasan-dev@...glegroups.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>, kernel-team@....com,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: [PATCH v1 03/11] mm/kasan: handle unaligned end address in zero_pte_populate
From: Joonsoo Kim <iamjoonsoo.kim@....com>
It doesn't handle unaligned end address so last pte could not
be initialized. Fix it.
Note that this shadow memory can be used by others so map
the actual page in this case.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....com>
---
mm/kasan/kasan_init.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c
index 554e4c0..48559d9 100644
--- a/mm/kasan/kasan_init.c
+++ b/mm/kasan/kasan_init.c
@@ -61,6 +61,14 @@ static void __init zero_pte_populate(pmd_t *pmd, unsigned long addr,
addr += PAGE_SIZE;
pte = pte_offset_kernel(pmd, addr);
}
+
+ if (addr == end)
+ return;
+
+ /* Population for unaligned end address */
+ zero_pte = pfn_pte(PFN_DOWN(
+ __pa(early_alloc(PAGE_SIZE, NUMA_NO_NODE))), PAGE_KERNEL);
+ set_pte_at(&init_mm, addr, pte, zero_pte);
}
static void __init zero_pmd_populate(pud_t *pud, unsigned long addr,
--
2.7.4
Powered by blists - more mailing lists