On Thu, Mar 09, 2017 at 01:20:30PM +0100, Michal Hocko wrote: > On Thu 09-03-17 14:47:16, Kirill A. Shutemov wrote: > > On Thu, Mar 09, 2017 at 10:54:15AM +0100, Michal Hocko wrote: > > > On Wed 08-03-17 18:21:30, Kirill A. Shutemov wrote: > [...] > > > > We can drop the hack once all architectures that support kasan would be > > > > converted to pgtable-nop4d.h -- amd64 and x86 at the moment. > > > > > > But those architectures even do not enable kasan > > > $ git grep "select *HAVE_ARCH_KASAN" > > > arch/arm64/Kconfig: select HAVE_ARCH_KASAN if SPARSEMEM_VMEMMAP && > > > !(ARM64_16K_PAGES && ARM64_VA_BITS_48) > > > arch/x86/Kconfig: select HAVE_ARCH_KASAN if X86_64 > > > && SPARSEMEM_VMEMMAP > > > > > > both arm64 and x86 (64b) do compile fine without the ifdef... So I guess > > > we should be fine without it. > > > > Have you build the image to the final linking? lm_alias() hides the error > > until later. > > > > x86-64 allmodconfig without the #ifndef: > > > > MODPOST vmlinux.o > > mm/built-in.o: In function `kasan_populate_zero_shadow': > > (.init.text+0xb72b): undefined reference to `kasan_zero_p4d' > > Makefile:983: recipe for target 'vmlinux' failed > > make: *** [vmlinux] Error 1 > > Interesting > arm64 cross compile: > $ grep CONFIG_KASAN .config > CONFIG_KASAN=y > CONFIG_KASAN_OUTLINE=y > # CONFIG_KASAN_INLINE is not set > > Compiling for arm64 with aarch64-linux using gcc 4.9.0 > [...] > LD vmlinux.o > MODPOST vmlinux.o > KSYM .tmp_kallsyms1.o > KSYM .tmp_kallsyms2.o > LD vmlinux > SORTEX vmlinux > SYSMAP System.map > > x86_64 crosscompile with the same version to rule out gcc version > changes > > $ grep CONFIG_KASAN .config > CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000 > CONFIG_KASAN=y > CONFIG_KASAN_OUTLINE=y > # CONFIG_KASAN_INLINE is not set > > [...] > LD init/built-in.o > LD vmlinux.o > MODPOST vmlinux.o > mm/built-in.o: In function `kasan_populate_zero_shadow': > (.init.text+0x84e5): undefined reference to `kasan_zero_p4d' > Makefile:983: recipe for target 'vmlinux' failed > > no idea why arm64 build was OK.
allmodconfig on amd64 enables 3-level paging, whcih produces nop pgd_populate(). defconfig + enabling CONFIG_KASAN would trigger the issue: mm/built-in.o: In function `kasan_populate_zero_shadow': /home/kas/linux/la57/mm/kasan/kasan_init.c:161: undefined reference to `kasan_zero_p4d' /home/kas/linux/la57/mm/kasan/kasan_init.c:161: undefined reference to `kasan_zero_p4d' Makefile:983: recipe for target 'vmlinux' failed make: *** [vmlinux] Error 1 > Anyway I am not insisting on removing this ifdef it is just too ugly to > spread __ARCH_HAS_5LEVEL_HACK outside of the arch code. We have few more > in the mm code but those look much more understandable. Maybe a short > comment explaining the ifdef would be better. Sure. Thanks. -- Kirill A. Shutemov