* [PATCH] arm/kasan: remove the unused code for kasan_pgd_populate
@ 2021-01-09 5:46 Hailong liu
0 siblings, 0 replies; only message in thread
From: Hailong liu @ 2021-01-09 5:46 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Hailong liu, Russell King, kasan-dev, linux-kernel,
Alexander Potapenko, Dmitry Vyukov, linux-arm-kernel
From: Hailong liu <liu.hailong6@zte.com.cn>
First, for arm architecture the pgdp is always the same as pmdp. So if we
alloc a table and fill in the entry then it will be overlay later by the
kasan_pmd_populate(), then there will be a leak for the table alloced
kasan_pgd_populate().
On the other hand, pgd_none() always return 0 for arm and therefore this
branch will never be walked.
Signed-off-by: Hailong liu <liu.hailong6@zte.com.cn>
---
arch/arm/mm/kasan_init.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c
index 9c348042a724..f0e591f7e430 100644
--- a/arch/arm/mm/kasan_init.c
+++ b/arch/arm/mm/kasan_init.c
@@ -126,21 +126,6 @@ static void __init kasan_pgd_populate(unsigned long addr, unsigned long end,
pgdp = pgd_offset_k(addr);
do {
- /*
- * Allocate and populate the shadow block of p4d folded into
- * pud folded into pmd if it doesn't already exist
- */
- if (!early && pgd_none(*pgdp)) {
- void *p = kasan_alloc_block(PAGE_SIZE);
-
- if (!p) {
- panic("%s failed to allocate shadow block for address 0x%lx\n",
- __func__, addr);
- return;
- }
- pgd_populate(&init_mm, pgdp, p);
- }
-
next = pgd_addr_end(addr, end);
/*
* We just immediately jump over the p4d and pud page
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-09 5:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 5:46 [PATCH] arm/kasan: remove the unused code for kasan_pgd_populate Hailong liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.