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]
Message-ID: <20160308142134.GB16832@treble.hsd1.ky.comcast.net>
Date:	Tue, 8 Mar 2016 08:21:34 -0600
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
	Michal Marek <mmarek@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Andy Lutomirski <luto@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Pedro Alves <palves@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Bernd Petrovitsch <bernd@...rovitsch.priv.at>,
	Chris J Arges <chris.j.arges@...onical.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiri Slaby <jslaby@...e.cz>,
	Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH v19 00/10] Compile-time stack metadata validation

On Tue, Mar 08, 2016 at 02:44:57PM +0100, Ingo Molnar wrote:
> 
> * Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> 
> > On Tue, Mar 08, 2016 at 11:37:16AM +0100, Ingo Molnar wrote:
> > > 
> > > * Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> > > 
> > > > This is v19 of the compile-time stack metadata validation patch set.
> > > > 
> > > > It's based on tip:core/objtool.
> > > 
> > > So I've upgraded my main build box to Fedora 23, to:
> > > 
> > >   gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
> > >   GNU assembler version 2.25 (x86_64-redhat-linux) using BFD version version 2.25-15.fc23
> > >   GNU ld version 2.25-15.fc23
> > > 
> > > and I'm now getting a bunch of these warnings:
> > > 
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2e7: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2f3: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2ff: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x30b: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x317: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x323: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x32f: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x33b: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x348: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x355: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x362: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x36f: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x37c: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x389: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x396: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2e7: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2f3: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2ff: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x30b: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x317: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x323: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x32f: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x33b: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x348: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x355: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x362: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x36f: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x37c: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x389: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x396: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x19a: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1a6: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1b2: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1be: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1ca: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1d6: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1e2: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1ee: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x1ff: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x210: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x221: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x251: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x262: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x273: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x284: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x295: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2a6: frame pointer state mismatch
> > > drivers/net/wireless/realtek/rtlwifi/base.o: warning: objtool: rtlwifi_rate_mapping()+0x2b7: frame pointer state mismatch
> > > 
> > > I see nothing particularly weird about rtlwifi_rate_mapping(), except the tons of 
> > > switch statements - maybe GCC does something really clever here?
> > > 
> > > In any case this needs to be addressed before the merge window. Also, I think we 
> > > should limit the number of objtool warnings to one per function?
> > 
> > This is a bug in objtool's handling of switch statement jump tables.  In
> > fact, the 0-day bot warned me about this bug yesterday, but I
> > misinterpreted it:
> > 
> >   https://lkml.kernel.org/r/201603060006.yNZ9xTcs%fengguang.wu@intel.com
> > 
> > I'll fix it up today.  I'll also limit the warnings to one per function.
> > 
> > BTW, I was only able to recreate this particular issue after updating to
> > today's tip/master.  It was triggered by a new config option:
> > CONFIG_UBSAN_SANITIZE_ALL.
> 
> ah, makes sense! I also upgraded to the latestest Fedora and misinterpreted the 
> warning.
> 
> Btw., I like it how in other cases you didn't try to work the warning around in 
> objtool, but improved the C code itself. We can consider this warning as a 
> 'unnecessarily complex switch statement' warning.

So the bug is that when there's more than one switch statement in a
function, objtool interprets all the switch jump tables as a single
table.  If the targets of one jump table assume a stack frame and the
targets of another one don't, you'll see frame pointer warnings like
those above.

It *is* interesting that both functions which triggered this bug --
rtlwifi_rate_mapping() and cik_tiling_mode_table_init() -- are cases
where the code is way too complex and can be simplified.

But, unless we want to institute an "only one switch statement allowed
per function" policy, I think I should still fix the bug.  Because I
don't really have the clout to tell people "you need to clean up your
code because my tool is buggy." :-)

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ