All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/*
@ 2016-02-01 17:08 Andrey Ryabinin
  2016-02-01 18:24 ` kbuild test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrey Ryabinin @ 2016-02-01 17:08 UTC (permalink / raw)
  To: akpm; +Cc: krinkin.m.u, ying.huang, davej, x86, linux-kernel, Andrey Ryabinin

On 01/30/2016 03:36 AM, Mike Krinkin wrote:
> option CONFIG_UBSAN_ALIGNMENT breaks x86-64 kernel with lockdep enabled,
> i. e kernel with CONFIG_UBSAN_ALIGNMENT fails to load without even any
> error message.
>
> The problem is that ubsan callbacks use spinlocks and might be called
> before lockdep is initialized.

There is also report from kernel test robot:
[    0.000000] WARNING: lockdep init error: lock 'report_lock' was acquired before lockdep_init().
[    0.000000] Call stack leading to lockdep invocation was:
[    0.000000]  [<b9e30ec5>] save_stack_trace+0x26/0x16d
[    0.000000]  [<b9f98054>] __lock_acquire+0x237/0x15a4
[    0.000000]  [<b9f994db>] lock_acquire+0x11a/0x1a9
[    0.000000]  [<bae228f9>] _raw_spin_lock_irqsave+0x39/0x49
[    0.000000]  [<ba5df852>] ubsan_prologue+0x1e/0x51
[    0.000000]  [<ba5dfb02>] __ubsan_handle_type_mismatch+0xbd/0x14a
[    0.000000]  [<bbca63c3>] reserve_ebda_region+0x8b/0x1bb
[    0.000000]  [<bbca632c>] i386_start_kernel+0xf6/0x102
[    0.000000]  [<ffffffff>] 0xffffffff

Let's disable aligment checks for x86-specific code since those are not
useful.
Changes around CFLAGS_UBSAN in this patch needed to be sure that cflags
from 'subdir-ccflags-' appears only after CFLAGS_UBSAN.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Reported-by: Mike Krinkin <krinkin.m.u@gmail.com>
---
 Makefile               | 2 +-
 arch/x86/Kbuild        | 2 ++
 scripts/Makefile.lib   | 4 ++--
 scripts/Makefile.ubsan | 5 +++++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 6c1a3c2..1da29a0 100644
--- a/Makefile
+++ b/Makefile
@@ -411,7 +411,7 @@ export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
-export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN CFLAGS_UBSAN
+export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN
 export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
 export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
 export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index 1538562..f1348ce 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -21,3 +21,5 @@ obj-y += platform/
 obj-y += net/
 
 obj-$(CONFIG_KEXEC_FILE) += purgatory/
+
+subdir-ccflags-$(CONFIG_UBSAN_ALIGNMENT) := $(call cc-option, -fno-sanitize=alignment)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 2edbcad..d7342cf 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -132,8 +132,8 @@ endif
 
 ifeq ($(CONFIG_UBSAN),y)
 _c_flags += $(if $(patsubst n%,, \
-		$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)), \
-		$(CFLAGS_UBSAN))
+		$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)),, \
+		$(DISABLE_UBSAN))
 endif
 
 # If building the kernel in a separate objtree expand all occurrences
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index 77ce538..91c1dd3 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -18,4 +18,9 @@ endif
       # -fsanitize=* options makes GCC less smart than usual and
       # increase number of 'maybe-uninitialized false-positives
       CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
+
+      KBUILD_CFLAGS += $(CFLAGS_UBSAN)
+      export DISABLE_UBSAN
+      DISABLE_UBSAN := $(call cc-option, -fno-sanitize=undefined)
+      DISABLE_UBSAN += $(call cc-option, -Wmaybe-uninitialized)
 endif
-- 
2.4.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/*
  2016-02-01 17:08 [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/* Andrey Ryabinin
@ 2016-02-01 18:24 ` kbuild test robot
  2016-02-01 19:09 ` kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-02-01 18:24 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: kbuild-all, akpm, krinkin.m.u, ying.huang, davej, x86,
	linux-kernel, Andrey Ryabinin

[-- Attachment #1: Type: text/plain, Size: 6563 bytes --]

Hi Andrey,

[auto build test WARNING on next-20160201]
[cannot apply to kbuild/for-next kbuild/rc-fixes v4.5-rc2 v4.5-rc1 v4.4-rc8 v4.5-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/ubsan-x86-disable-alignemnt-checks-for-arch-x86/20160202-010948
config: i386-randconfig-c0-02020138 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/char/tpm/tpm2-cmd.c: In function 'tpm2_unseal_trusted':
>> drivers/char/tpm/tpm2-cmd.c:600:3: warning: 'blob_handle' may be used uninitialized in this function [-Wmaybe-uninitialized]
      dev_warn(chip->pdev, "0x%08x was not flushed, out of memory\n",
      ^
   drivers/char/tpm/tpm2-cmd.c:668:6: note: 'blob_handle' was declared here
     u32 blob_handle;
         ^
--
   drivers/gpio/gpiolib-of.c: In function 'of_gpiochip_add':
>> drivers/gpio/gpiolib-of.c:221:7: warning: 'dflags' may be used uninitialized in this function [-Wmaybe-uninitialized]
      if (gpiod_hog(desc, name, lflags, dflags))
          ^
   drivers/gpio/gpiolib-of.c:211:19: note: 'dflags' was declared here
     enum gpiod_flags dflags;
                      ^
>> drivers/gpio/gpiolib-of.c:221:7: warning: 'lflags' may be used uninitialized in this function [-Wmaybe-uninitialized]
      if (gpiod_hog(desc, name, lflags, dflags))
          ^
   drivers/gpio/gpiolib-of.c:210:25: note: 'lflags' was declared here
     enum gpio_lookup_flags lflags;
                            ^
--
   drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_read_status':
>> drivers/media/dvb-frontends/drx39xyj/drxj.c:10737:33: warning: 'mer' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->cnr.stat[0].svalue = mer * 100;
                                    ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10670:6: note: 'mer' was declared here
     u16 mer, strength = 0;
         ^
>> drivers/media/dvb-frontends/drx39xyj/drxj.c:10728:38: warning: 'ber' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->post_bit_error.stat[0].uvalue += ber;
                                         ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10669:6: note: 'ber' was declared here
     u32 ber, cnt, err, pkt;
         ^
>> drivers/media/dvb-frontends/drx39xyj/drxj.c:10705:35: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->block_error.stat[0].uvalue += err;
                                      ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10669:16: note: 'err' was declared here
     u32 ber, cnt, err, pkt;
                   ^
--
   drivers/media/tuners/tda18218.c: In function 'tda18218_attach':
>> drivers/media/tuners/tda18218.c:324:10: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (ret || val != def_regs[R00_ID]) {
             ^
--
   In file included from drivers/spi/spidev.c:28:0:
   drivers/spi/spidev.c: In function 'spidev_ioctl':
>> include/linux/slab.h:562:9: warning: 'n_ioc' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return __kmalloc(n * size, flags);
            ^
   drivers/spi/spidev.c:362:12: note: 'n_ioc' was declared here
     unsigned  n_ioc;
               ^
--
   fs/btrfs/send.c: In function '__iterate_backrefs':
>> fs/btrfs/send.c:1228:5: warning: 'i_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (offset + bctx->data_offset + bctx->extent_len > i_size)
        ^
--
   ipc/shm.c: In function 'SyS_shmdt':
>> ipc/shm.c:1311:59: warning: 'file' may be used uninitialized in this function [-Wmaybe-uninitialized]
          ((vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) &&
                                                              ^
   ipc/shm.c:1234:15: note: 'file' was declared here
     struct file *file;
                  ^
--
   mm/vmscan.c: In function 'shrink_zone':
>> mm/vmscan.c:2410:18: warning: 'lru_pages' may be used uninitialized in this function [-Wmaybe-uninitialized]
       unsigned long lru_pages;
                     ^
--
   net/core/dev.c: In function 'validate_xmit_skb_list':
>> net/core/dev.c:2984:15: warning: 'tail' may be used uninitialized in this function [-Wmaybe-uninitialized]
       tail->next = skb;
                  ^

vim +/blob_handle +600 drivers/char/tpm/tpm2-cmd.c

954650ef Jarkko Sakkinen 2015-05-30  584  out:
954650ef Jarkko Sakkinen 2015-05-30  585  	tpm_buf_destroy(&buf);
954650ef Jarkko Sakkinen 2015-05-30  586  
954650ef Jarkko Sakkinen 2015-05-30  587  	if (rc > 0)
954650ef Jarkko Sakkinen 2015-05-30  588  		rc = -EPERM;
954650ef Jarkko Sakkinen 2015-05-30  589  
954650ef Jarkko Sakkinen 2015-05-30  590  	return rc;
954650ef Jarkko Sakkinen 2015-05-30  591  }
954650ef Jarkko Sakkinen 2015-05-30  592  
954650ef Jarkko Sakkinen 2015-05-30  593  static void tpm2_flush_context(struct tpm_chip *chip, u32 handle)
954650ef Jarkko Sakkinen 2015-05-30  594  {
954650ef Jarkko Sakkinen 2015-05-30  595  	struct tpm_buf buf;
954650ef Jarkko Sakkinen 2015-05-30  596  	int rc;
954650ef Jarkko Sakkinen 2015-05-30  597  
954650ef Jarkko Sakkinen 2015-05-30  598  	rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_FLUSH_CONTEXT);
954650ef Jarkko Sakkinen 2015-05-30  599  	if (rc) {
954650ef Jarkko Sakkinen 2015-05-30 @600  		dev_warn(chip->pdev, "0x%08x was not flushed, out of memory\n",
954650ef Jarkko Sakkinen 2015-05-30  601  			 handle);
954650ef Jarkko Sakkinen 2015-05-30  602  		return;
954650ef Jarkko Sakkinen 2015-05-30  603  	}
954650ef Jarkko Sakkinen 2015-05-30  604  
954650ef Jarkko Sakkinen 2015-05-30  605  	tpm_buf_append_u32(&buf, handle);
954650ef Jarkko Sakkinen 2015-05-30  606  
954650ef Jarkko Sakkinen 2015-05-30  607  	rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "flushing context");
954650ef Jarkko Sakkinen 2015-05-30  608  	if (rc)

:::::: The code at line 600 was first introduced by commit
:::::: 954650efb79f99d5c817c121bb0a7c6c53362048 tpm: seal/unseal for TPM 2.0

:::::: TO: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
:::::: CC: Peter Huewe <peterhuewe@gmx.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 22900 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/*
  2016-02-01 17:08 [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/* Andrey Ryabinin
  2016-02-01 18:24 ` kbuild test robot
@ 2016-02-01 19:09 ` kbuild test robot
  2016-02-01 20:16 ` kbuild test robot
  2016-02-01 21:09 ` Mike Krinkin
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-02-01 19:09 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: kbuild-all, akpm, krinkin.m.u, ying.huang, davej, x86,
	linux-kernel, Andrey Ryabinin

[-- Attachment #1: Type: text/plain, Size: 10450 bytes --]

Hi Andrey,

[auto build test WARNING on next-20160201]
[cannot apply to kbuild/for-next kbuild/rc-fixes v4.5-rc2 v4.5-rc1 v4.4-rc8 v4.5-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/ubsan-x86-disable-alignemnt-checks-for-arch-x86/20160202-010948
config: arm-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   net/mac80211/tx.c: In function 'ieee80211_build_hdr':
   net/mac80211/tx.c:2070:27: warning: 'chanctx_conf' may be used uninitialized in this function [-Wmaybe-uninitialized]
      band = chanctx_conf->def.chan->band;
                              ^
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   In file included from net/mac80211/ieee80211_i.h:35:0,
                    from net/mac80211/mlme.c:29:
   net/mac80211/mlme.c: In function 'ieee80211_rx_mgmt_beacon':
   net/mac80211/debug.h:93:2: warning: 'pwr_level_cisco' may be used uninitialized in this function [-Wmaybe-uninitialized]
     __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__)
     ^
   net/mac80211/mlme.c:1321:6: note: 'pwr_level_cisco' was declared here
     int pwr_level_cisco, pwr_level_80211h;
         ^
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> arm-unknown-linux-gnueabi-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 56261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/*
  2016-02-01 17:08 [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/* Andrey Ryabinin
  2016-02-01 18:24 ` kbuild test robot
  2016-02-01 19:09 ` kbuild test robot
@ 2016-02-01 20:16 ` kbuild test robot
  2016-02-01 21:09 ` Mike Krinkin
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-02-01 20:16 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: kbuild-all, akpm, krinkin.m.u, ying.huang, davej, x86,
	linux-kernel, Andrey Ryabinin

[-- Attachment #1: Type: text/plain, Size: 14717 bytes --]

Hi Andrey,

[auto build test WARNING on next-20160201]
[cannot apply to kbuild/for-next kbuild/rc-fixes v4.5-rc2 v4.5-rc1 v4.4-rc8 v4.5-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Andrey-Ryabinin/ubsan-x86-disable-alignemnt-checks-for-arch-x86/20160202-010948
config: m68k-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/tty/serial/ifx6x60.c: In function 'ifx_spi_complete':
   drivers/tty/serial/ifx6x60.c:715:8: warning: 'more' may be used uninitialized in this function [-Wmaybe-uninitialized]
        if (more)
           ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_read_status':
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10737:33: warning: 'mer' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->cnr.stat[0].svalue = mer * 100;
                                    ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10670:6: note: 'mer' was declared here
     u16 mer, strength = 0;
         ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10728:38: warning: 'ber' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->post_bit_error.stat[0].uvalue += ber;
                                         ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10669:6: note: 'ber' was declared here
     u32 ber, cnt, err, pkt;
         ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10705:35: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
        p->block_error.stat[0].uvalue += err;
                                      ^
   drivers/media/dvb-frontends/drx39xyj/drxj.c:10669:16: note: 'err' was declared here
     u32 ber, cnt, err, pkt;
                   ^
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/video/backlight/adp8860_bl.c: In function 'adp8860_bl_ambient_light_level_show':
   drivers/video/backlight/adp8860_bl.c:579:10: warning: 'ret_val' may be used uninitialized in this function [-Wmaybe-uninitialized]
     ret_val += (reg_val & 0x1F) << 8;
             ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/w1/slaves/w1_therm.c: In function 'w1_slave_show':
   drivers/w1/slaves/w1_therm.c:313:7: warning: 'crc' may be used uninitialized in this function [-Wmaybe-uninitialized]
     c -= snprintf(buf + PAGE_SIZE - c, c, ": crc=%02x %s\n",
          ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   In file included from include/linux/printk.h:287:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/net/ethernet/amd/xgbe/xgbe-mdio.c:117:
   drivers/net/ethernet/amd/xgbe/xgbe-mdio.c: In function 'xgbe_serdes_complete_ratechange':
   include/linux/dynamic_debug.h:94:3: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized]
      __dynamic_netdev_dbg(&descriptor, dev, fmt, \
      ^
   drivers/net/ethernet/amd/xgbe/xgbe-mdio.c:172:6: note: 'status' was declared here
     u16 status;
         ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c: In function 'xgene_sgmac_init':
   drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c:256:34: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!(data & AUTO_NEG_COMPLETE) || !(data & LINK_STATUS))
                                     ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/net/wireless/ath/ath6kl/init.c: In function '__ath6kl_init_hw_start':
   drivers/net/wireless/ath/ath6kl/init.c:1249:3: warning: 'board_ext_address' may be used uninitialized in this function [-Wmaybe-uninitialized]
      ath6kl_dbg(ATH6KL_DBG_BOOT,
      ^
   drivers/net/wireless/ath/ath6kl/init.c:1193:21: note: 'board_ext_address' was declared here
     u32 board_address, board_ext_address, param;
                        ^
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   drivers/net/ethernet/hisilicon/hns/hns_enet.c: In function 'hns_nic_rx_poll_one':
   drivers/net/ethernet/hisilicon/hns/hns_enet.c:756:12: warning: 'bnum' may be used uninitialized in this function [-Wmaybe-uninitialized]
      recv_bds += bnum;
               ^
--
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
   net/core/dev.c: In function 'validate_xmit_skb_list':
   net/core/dev.c:2984:15: warning: 'tail' may be used uninitialized in this function [-Wmaybe-uninitialized]
       tail->next = skb;
                  ^
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'bounds'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'object-size'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
>> m68k-linux-gcc: warning: unrecognized argument to -fsanitize= option: 'alignment'
   cc1: warning: unrecognized argument to -fsanitize= option: 'bounds'
   cc1: warning: unrecognized argument to -fsanitize= option: 'object-size'
   cc1: warning: unrecognized argument to -fsanitize= option: 'returns-nonnull-attribute'
   cc1: warning: unrecognized argument to -fsanitize= option: 'alignment'
..

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 35769 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/*
  2016-02-01 17:08 [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/* Andrey Ryabinin
                   ` (2 preceding siblings ...)
  2016-02-01 20:16 ` kbuild test robot
@ 2016-02-01 21:09 ` Mike Krinkin
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Krinkin @ 2016-02-01 21:09 UTC (permalink / raw)
  To: Andrey Ryabinin; +Cc: akpm, ying.huang, davej, x86, linux-kernel

Works well for me, thank you.

Tested-by: Mike Krinkin <krinkin.m.u@gmail.com>

On Mon, Feb 01, 2016 at 08:08:19PM +0300, Andrey Ryabinin wrote:
> On 01/30/2016 03:36 AM, Mike Krinkin wrote:
> > option CONFIG_UBSAN_ALIGNMENT breaks x86-64 kernel with lockdep enabled,
> > i. e kernel with CONFIG_UBSAN_ALIGNMENT fails to load without even any
> > error message.
> >
> > The problem is that ubsan callbacks use spinlocks and might be called
> > before lockdep is initialized.
> 
> There is also report from kernel test robot:
> [    0.000000] WARNING: lockdep init error: lock 'report_lock' was acquired before lockdep_init().
> [    0.000000] Call stack leading to lockdep invocation was:
> [    0.000000]  [<b9e30ec5>] save_stack_trace+0x26/0x16d
> [    0.000000]  [<b9f98054>] __lock_acquire+0x237/0x15a4
> [    0.000000]  [<b9f994db>] lock_acquire+0x11a/0x1a9
> [    0.000000]  [<bae228f9>] _raw_spin_lock_irqsave+0x39/0x49
> [    0.000000]  [<ba5df852>] ubsan_prologue+0x1e/0x51
> [    0.000000]  [<ba5dfb02>] __ubsan_handle_type_mismatch+0xbd/0x14a
> [    0.000000]  [<bbca63c3>] reserve_ebda_region+0x8b/0x1bb
> [    0.000000]  [<bbca632c>] i386_start_kernel+0xf6/0x102
> [    0.000000]  [<ffffffff>] 0xffffffff
> 
> Let's disable aligment checks for x86-specific code since those are not
> useful.
> Changes around CFLAGS_UBSAN in this patch needed to be sure that cflags
> from 'subdir-ccflags-' appears only after CFLAGS_UBSAN.
> 
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Reported-by: kernel test robot <ying.huang@linux.intel.com>
> Reported-by: Mike Krinkin <krinkin.m.u@gmail.com>
> ---
>  Makefile               | 2 +-
>  arch/x86/Kbuild        | 2 ++
>  scripts/Makefile.lib   | 4 ++--
>  scripts/Makefile.ubsan | 5 +++++
>  4 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 6c1a3c2..1da29a0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -411,7 +411,7 @@ export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
>  export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
>  
>  export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
> -export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN CFLAGS_UBSAN
> +export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN
>  export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
>  export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
>  export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
> diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
> index 1538562..f1348ce 100644
> --- a/arch/x86/Kbuild
> +++ b/arch/x86/Kbuild
> @@ -21,3 +21,5 @@ obj-y += platform/
>  obj-y += net/
>  
>  obj-$(CONFIG_KEXEC_FILE) += purgatory/
> +
> +subdir-ccflags-$(CONFIG_UBSAN_ALIGNMENT) := $(call cc-option, -fno-sanitize=alignment)
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 2edbcad..d7342cf 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -132,8 +132,8 @@ endif
>  
>  ifeq ($(CONFIG_UBSAN),y)
>  _c_flags += $(if $(patsubst n%,, \
> -		$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)), \
> -		$(CFLAGS_UBSAN))
> +		$(UBSAN_SANITIZE_$(basetarget).o)$(UBSAN_SANITIZE)$(CONFIG_UBSAN_SANITIZE_ALL)),, \
> +		$(DISABLE_UBSAN))
>  endif
>  
>  # If building the kernel in a separate objtree expand all occurrences
> diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
> index 77ce538..91c1dd3 100644
> --- a/scripts/Makefile.ubsan
> +++ b/scripts/Makefile.ubsan
> @@ -18,4 +18,9 @@ endif
>        # -fsanitize=* options makes GCC less smart than usual and
>        # increase number of 'maybe-uninitialized false-positives
>        CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
> +
> +      KBUILD_CFLAGS += $(CFLAGS_UBSAN)
> +      export DISABLE_UBSAN
> +      DISABLE_UBSAN := $(call cc-option, -fno-sanitize=undefined)
> +      DISABLE_UBSAN += $(call cc-option, -Wmaybe-uninitialized)
>  endif
> -- 
> 2.4.10
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-01 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 17:08 [PATCH -mm] ubsan, x86: disable alignemnt checks for arch/x86/* Andrey Ryabinin
2016-02-01 18:24 ` kbuild test robot
2016-02-01 19:09 ` kbuild test robot
2016-02-01 20:16 ` kbuild test robot
2016-02-01 21:09 ` Mike Krinkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.