[PATCH] objtool: Disable stack validation when CROSS_COMPILE is used

From: Josh Poimboeuf
Date: Tue Mar 01 2016 - 16:55:00 EST


On Tue, Mar 01, 2016 at 08:40:01PM +1100, Stephen Rothwell wrote:
> Hi Ingo,
>
> On Tue, 1 Mar 2016 08:07:50 +0100 Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> > > This build is done with a PowerPC hosted cross compiler with no glibc.
> >
> > Ugh, what a rare and weird way to build an x86 kernel, and you made linux-next
> > dependent on it?
>
> It is just the fastest hardware I currently have access to (you remember
> who I work for, right? ;-)). I have always done at least part of the
> linux-next building (daily, or overnight) on PowerPC hardware and this
> is only the 2nd or third time in over 8 years that it has found an
> issue like this.
>
> > > I assume that some things here need to be built with HOSTCC?
> >
> > I suspect that's the culprit.
>
> Good, hopefully it is not too hard to fix.

Changing it to use the host compiler would probably be an easy fix, but
that would expose a harder bug related to endianness.

objtool uses the kernel x86 decoder (arch/x86/lib/insn.c) which is
endian-ignorant. If it tries to analyze reverse endian binaries it gets
confused. And since CONFIG_STACK_VALIDATION causes objtool to analyze
every .o file in the build, it'll spit out a ton of false warnings.

How about the below workaround patch to disable objtool and warn when
CROSS_COMPILE is used? If anybody complains about lack of cross-compile
support later, we could try to fix it then.