[PATCH v1 03/11] mm/kasan: handle unaligned end address in zero_pte_populate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>

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@xxxxxxx>
---
 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux