linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: kbuild test robot <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: kbuild-all@01.org, Johannes Weiner <hannes@cmpxchg.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: 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: Fri, 06 Feb 2015 20:45:16 +0300	[thread overview]
Message-ID: <54D4FDAC.60203@samsung.com> (raw)
In-Reply-To: <201502050342.47w5t7vH%fengguang.wu@intel.com>

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@samsung.com>
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@samsung.com>
---
 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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-02-06 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 19:24 kbuild test robot
2015-02-06 17:45 ` Andrey Ryabinin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D4FDAC.60203@samsung.com \
    --to=a.ryabinin@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild-all@01.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox