lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Nov 2018 12:40:33 -0500
From:   Qian Cai <cai@....us>
To:     akpm@...ux-foundation.org
Cc:     catalin.marinas@....com, mhocko@...e.com, rppt@...ux.vnet.ibm.com,
        aryabinin@...tuozzo.com, glider@...gle.com, dvyukov@...gle.com,
        kasan-dev@...glegroups.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Qian Cai <cai@....us>
Subject: [PATCH] mm/memblock: skip kmemleak for kasan_init()

Kmemleak does not play well with KASAN (tested on both HPE Apollo 70 and
Huawei TaiShan 2280 aarch64 servers).

After calling start_kernel()->setup_arch()->kasan_init(), kmemleak early
log buffer went from something like 280 to 260000 which caused kmemleak
disabled and crash dump memory reservation failed. The multitude of
kmemleak_alloc() calls is from,

for_each_memblock(memory, reg) x \
while (pgdp++, addr = next, addr != end) x \
while (pudp++, addr = next, addr != end && pud_none(READ_ONCE(*pudp))) \
while (pmdp++, addr = next, addr != end && pmd_none(READ_ONCE(*pmdp))) \
while (ptep++, addr = next, addr != end && pte_none(READ_ONCE(*ptep)))

Signed-off-by: Qian Cai <cai@....us>
---
 mm/memblock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memblock.c b/mm/memblock.c
index 9a2d5ae..fd78e39 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1412,6 +1412,8 @@ static void * __init memblock_alloc_internal(
 done:
 	ptr = phys_to_virt(alloc);
 
+/* Skip kmemleak for kasan_init() due to high volume. */
+#ifndef CONFIG_KASAN
 	/*
 	 * The min_count is set to 0 so that bootmem allocated blocks
 	 * are never reported as leaks. This is because many of these blocks
@@ -1419,6 +1421,7 @@ static void * __init memblock_alloc_internal(
 	 * looked up by kmemleak.
 	 */
 	kmemleak_alloc(ptr, size, 0, 0);
+#endif
 
 	return ptr;
 }
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ