Re: [mmotm:master 409/551] WARNING: arch/x86/kernel/cpu/microcode/microcode.o(.data+0x1cf0): Section mismatch in reference from the variable microcode_mutex to the variable .init.rodata:__mod_x86cpu__microcode_id_device_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/04/2015 10:24 PM, kbuild test robot wrote:
> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   f03806f9a6908743ed1902389be1a4a6198852be
> commit: 7bc18a57df7c27948b9d93fa4eefc20e3e200512 [409/551] kasan: enable instrumentation of global variables
> config: x86_64-allmodconfig (attached as .config)
> reproduce:
>   git checkout 7bc18a57df7c27948b9d93fa4eefc20e3e200512
>   # save the attached .config to linux build tree
>   make ARCH=x86_64 
> 
> All warnings:
> 
>>> WARNING: arch/x86/kernel/cpu/microcode/microcode.o(.data+0x1cf0): Section mismatch in reference from the variable microcode_mutex to the variable .init.rodata:__mod_x86cpu__microcode_id_device_table
>    The variable microcode_mutex references
>    the variable __initconst __mod_x86cpu__microcode_id_device_table


Obviously 'microcode_mutex' doesn't reference '__mod_x86cpu__microcode_id_device_table'.
Actually this is struct kasan_global describing '__mod_x86cpu__microcode_id_device_table'
variable references it.

Normally GCC doesn't instrument globals in user-specified sections.
So we shouldn't have kasan_global struct for '__mod_x86cpu__microcode_id_device_table',
because this symbol doesn't have redzone.

'__mod_x86cpu__microcode_id_device_table' is an alias to 'microcode_id' symbol and
alias declared without specifying section.
It seems that GCC looks only on declaration, and it thinks that __mod_x86cpu__microcode_id_device_table
is in default section.
So we poison redzone for microcode_id symbol, which don't have redzone. IOW we poison some valid memory.

This bug already fixed in trunk GCC, but it present in 4.9.2.

I think the best option here is just disable globals instrumentation for 4.9.2.
In addition to patch bellow, 'kernel-add-support-for-init_array-constructors.patch' patch
could be dropped, as we needed it only for 4.9.2 GCC.

----
From: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx>
Subject: kasan-enable-instrumentation-of-global-variables-fix-2

Disable broken globals instrumentation for GCC 4.9.2

Signed-off-by: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx>
---
 scripts/Makefile.kasan | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 72a40bb..631619b 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -5,7 +5,7 @@ else
 	call_threshold := 0
 endif

-CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address --param asan-globals=1
+CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address

 CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
 		-fasan-shadow-offset=$(CONFIG_KASAN_SHADOW_OFFSET) \
-- 
2.2.2


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]