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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Aug 2021 10:04:19 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Randy Dunlap <rdunlap@...radead.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Nathan Chancellor <nathan@...nel.org>
Subject: Re: linux-next: Tree for Aug 20 (Wno-alloc-size-larger-than)

On Tue, Aug 24, 2021 at 11:58:59AM +1000, Stephen Rothwell wrote:
> On Mon, 23 Aug 2021 18:24:44 -0700 Randy Dunlap <rdunlap@...radead.org> wrote:
> >
> > This is just weird. What I am seeing is that for every source file
> > where gcc emits a warning: it then follows that up with this
> > >> cc1: warning: unrecognized command line option '-Wno-alloc-size-larger-than'  
> 
> I see the same, as well as:
> 
> <stdin>:1515:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> cc1: warning: unrecognized command line option '-Wno-alloc-size-larger-than'
> 
> But only on my gcc 7.3.1 builds (the rest are gcc 10).
> 
> > Smells like a gcc bug to me.
> 
> Yes
> 
> Also noted here: https://github.com/DynamoRIO/drmemory/issues/2099 (second comment)

Okay, I think this work-around should work. I've been able to reproduce
the weird conditions, and this seems to behave correctly. Andrew, can
you fixup the fixup with this?


diff --git a/Makefile b/Makefile
index 26640899e7ca..c1842014a5de 100644
--- a/Makefile
+++ b/Makefile
@@ -1094,8 +1094,13 @@ endif
 
 ifdef CONFIG_CC_IS_GCC
 # The allocators already balk at large sizes, so silence the compiler
-# warnings for bounds checks involving those possible values.
-KBUILD_CFLAGS += $(call cc-option, -Wno-alloc-size-larger-than)
+# warnings for bounds checks involving those possible values. While
+# -Wno-alloc-size-larger-than would normally be used here, some versions
+# of gcc (<9.1) weirdly don't handle the option correctly when _other_
+# warnings are produced (?!), so instead use SIZE_MAX to effectively
+# disable it.
+# https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au
+KBUILD_CFLAGS += $(call cc-option, -Walloc-size-larger-than=SIZE_MAX)
 endif
 
 # disable invalid "can't wrap" optimizations for signed / pointers


-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ