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


Groups > linux.kernel > #1642155 > unrolled thread

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

Started byjs1304@gmail.com
First post2017-05-16 03:20 +0200
Last post2017-05-16 03:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 03/11] mm/kasan: handle unaligned end address in zero_pte_populate js1304@gmail.com - 2017-05-16 03:20 +0200

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

Fromjs1304@gmail.com
Date2017-05-16 03:20 +0200
Subject[PATCH v1 03/11] mm/kasan: handle unaligned end address in zero_pte_populate
Message-ID<tHzjA-7hu-11@gated-at.bofh.it>
From: Joonsoo Kim <iamjoonsoo.kim@lge.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@lge.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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web