2015-02-09 16:05:41

by Jim Davis

[permalink] [raw]
Subject: randconfig build error with next-20150209, in arch/x86/mm/kasan_init_64.c

Building with the attached random configuration file,

arch/x86/built-in.o: In function `populate_zero_shadow':
kasan_init_64.c:(.init.text+0xe2cc): undefined reference to
`vmemmap_alloc_block'
kasan_init_64.c:(.init.text+0xe3ab): undefined reference to
`vmemmap_alloc_block'
kasan_init_64.c:(.init.text+0xe483): undefined reference to
`vmemmap_alloc_block'
arch/x86/built-in.o: In function `kasan_init':
(.init.text+0xe65d): undefined reference to `vmemmap_populate'
arch/x86/built-in.o: In function `kasan_init':
(.init.text+0xe6ea): undefined reference to `vmemmap_populate'
make: *** [vmlinux] Error 1


Attachments:
randconfig-1423477352.txt (82.74 kB)

2015-02-10 10:35:15

by Andrey Ryabinin

[permalink] [raw]
Subject: [PATCH] x86_64-add-kasan-support-fix

Combination of CONFIG_SPARSEMEM_VMEMMAP=n, CONFIG_KASAN=y
cause build error:
arch/x86/built-in.o: In function `populate_zero_shadow':
kasan_init_64.c:(.init.text+0xe2cc): undefined reference to
`vmemmap_alloc_block'
kasan_init_64.c:(.init.text+0xe3ab): undefined reference to
`vmemmap_alloc_block'
kasan_init_64.c:(.init.text+0xe483): undefined reference to
`vmemmap_alloc_block'
arch/x86/built-in.o: In function `kasan_init':
(.init.text+0xe65d): undefined reference to `vmemmap_populate'
arch/x86/built-in.o: In function `kasan_init':
(.init.text+0xe6ea): undefined reference to `vmemmap_populate'
make: *** [vmlinux] Error 1

x86_64-specific part of KASAN depends on SPARSEMEM_VMEMMAP.
Express this in Kconfig.

Signed-off-by: Andrey Ryabinin <[email protected]>
Reported-by: Jim Davis <[email protected]>
---
arch/x86/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 1607c46..1e78e3c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -85,7 +85,7 @@ config X86
select HAVE_CMPXCHG_LOCAL
select HAVE_CMPXCHG_DOUBLE
select HAVE_ARCH_KMEMCHECK
- select HAVE_ARCH_KASAN if X86_64
+ select HAVE_ARCH_KASAN if X86_64 && SPARSEMEM_VMEMMAP
select HAVE_USER_RETURN_NOTIFIER
select ARCH_BINFMT_ELF_RANDOMIZE_PIE
select HAVE_ARCH_JUMP_LABEL
--
2.3.0