linux-stable/arch/arm64
Qian Cai fed84c7852 mm/memblock.c: 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 nested loops while KASAN is setting up full
memory mappings, so let early kmemleak allocations skip those
memblock_alloc_internal() calls came from kasan_init() given that those
early KASAN memory mappings should not reference to other memory.  Hence,
no kmemleak false positives.

kasan_init
  kasan_map_populate [1]
    kasan_pgd_populate [2]
      kasan_pud_populate [3]
        kasan_pmd_populate [4]
          kasan_pte_populate [5]
            kasan_alloc_zeroed_page
              memblock_alloc_try_nid
                memblock_alloc_internal
                  kmemleak_alloc

[1] for_each_memblock(memory, reg)
[2] while (pgdp++, addr = next, addr != end)
[3] while (pudp++, addr = next, addr != end && pud_none(READ_ONCE(*pudp)))
[4] while (pmdp++, addr = next, addr != end && pmd_none(READ_ONCE(*pmdp)))
[5] while (ptep++, addr = next, addr != end && pte_none(READ_ONCE(*ptep)))

Link: http://lkml.kernel.org/r/1543442925-17794-1-git-send-email-cai@gmx.us
Signed-off-by: Qian Cai <cai@gmx.us>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-12-28 12:11:49 -08:00
..
boot ARM: SoC fixes 2018-12-10 09:06:22 -08:00
configs arm64: defconfig: Enable some IPMI configs 2018-11-02 11:39:50 -07:00
crypto crypto: arm64/chacha - use combined SIMD/ALU routine for more speed 2018-12-13 18:24:55 +08:00
include kasan, mm, arm64: tag non slab memory allocated via pagealloc 2018-12-28 12:11:44 -08:00
kernel kasan, arm64: add brk handler for inline instrumentation 2018-12-28 12:11:44 -08:00
kvm * ARM: selftests improvements, large PUD support for HugeTLB, 2018-12-26 11:46:28 -08:00
lib arm64: string: use asm EXPORT_SYMBOL() 2018-12-10 11:50:12 +00:00
mm mm/memblock.c: skip kmemleak for kasan_init() 2018-12-28 12:11:49 -08:00
net bpf: arm64: Enable arm64 jit to provide bpf_line_info 2018-12-12 02:16:56 +01:00
xen
Kconfig kasan, arm64: select HAVE_ARCH_KASAN_SW_TAGS 2018-12-28 12:11:44 -08:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Kconfig.platforms ARM: SoC platform updates for 4.20 2018-10-29 15:37:33 -07:00
Makefile kasan, arm64: adjust shadow size for tag-based mode 2018-12-28 12:11:43 -08:00