lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201303251544.55765.arnd@arndb.de>
Date:	Mon, 25 Mar 2013 15:44:55 +0000
From:	Arnd Bergmann <arnd@...db.de>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	linux-kbuild@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Marek <mmarek@...e.cz>,
	"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
	"Russell King - ARM Linux" <linux@....linux.org.uk>
Subject: [PATCH] Turn off -Wmaybe-uninitialized when building with -Os

gcc-4.7 and higher add a lot of false positive warnings about
potential uses of uninitialized warnings, but only when optimizing
for size (-Os). This is the default when building allyesconfig,
which turns on CONFIG_CC_OPTIMIZE_FOR_SIZE.

In order to avoid getting a lot of patches that initialize such
variables and accidentally hide real errors along the way, let's
just turn off this warning on the respective gcc versions
when building with size optimizations. The -Wmaybe-uninitialized
option was introduced in the same gcc version (4.7) that is now
causing the false positives, so there is no effect on older compilers.

A side effect is that when building with CONFIG_CC_OPTIMIZE_FOR_SIZE,
we might now see /fewer/ warnings about possibly uninitialized
warnings than with -O2, but that is still much better than seeing
warnings known to be bogus.

Building v3.9-rc3 allmodconfig shows how the number of false
positives is reduced:

74	x86-linux-gcc-4.7 -Os
12	x86-linux-gcc-4.7 -O2
 1	x86-linux-gcc-4.7 -Os -Wno-maybe-uninitialized
 8	arm-linux-gcc-4.6 -Os
 8	arm-linux-gcc-4.6 -Os
50	arm-linux-gcc-4.7 -Os
 8	arm-linux-gcc-4.7 -O2
 0	arm-linux-gcc-4.7 -Os -Wno-maybe-uninitialized
33	arm-linux-gcc-4.8 -Os
13	arm-linux-gcc-4.8 -O2
 0	arm-linux-gcc-4.8 -Os -Wno-maybe-uninitialized

The 8 to 13 warnings that are now hidden compared to the -O2 output
seem to all be false positives as well. The total number of
all other warnings I see is (independent of optimization level)

24	x86-linux-gcc-4.7
19	arm-linux-gcc-4.6
17	arm-linux-gcc-4.7
16	arm-linux-gcc-4.8

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
diff --git a/Makefile b/Makefile
index 22113a7..d8e3f36 100644
--- a/Makefile
+++ b/Makefile
@@ -570,7 +570,7 @@ endif # $(dot-config)
 all: vmlinux
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS	+= -Os
+KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
 KBUILD_CFLAGS	+= -O2
 endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ