linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@suse.de>, Nick Desaulniers <ndesaulniers@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	mingo@redhat.com, x86@kernel.org,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	Kees Cook <keescook@chromium.org>,
	Cao jin <caoj.fnst@cn.fujitsu.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/boot: define CC_HAVE_ASM_GOTO
Date: Fri, 28 Sep 2018 13:41:46 -0700	[thread overview]
Message-ID: <56442061-7f55-878d-5b26-7cdd14e901d2@zytor.com> (raw)
In-Reply-To: <20180926090841.GC5745@zn.tnic>

On 09/26/18 02:08, Borislav Petkov wrote:
> On Tue, Sep 25, 2018 at 02:13:16PM -0700, Nick Desaulniers wrote:
>> Orthogonally, do you know *why* this Makefile overwrites
>> KBUILD_CFLAGS?  We take great care to set various compiler flags in
>> the top level Makefile, so to reset them lower in the tree seems
>> troublesome on first glance.  Take for instance the fact that GCC
>> changed the default C standard from gnu89 to gnu11 in GCC 5.  So a
>> kernel dev with gcc 5+ is now building a kernel with some translation
>> units built as gnu89, and some as gnu11.
> 
> Right, so I'd defer to hpa for a definitive answer here but AFAICT, the
> reasoning is that because this is the special relocatable compressed
> kernel and as such, it is redefining build flags completely so that
> nothing leaks from kernel proper.
> 
> Which is funny because what happens is, that something *does* leak,
> and what you're trying to fix is one incarnation. Because we do use
> facilities from include/linux/. And looking at your error:
> 
> #warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
> 
> I don't think it does matter to the compressed kernel whether the
> compiler has asm goto or not.
> 
> And looking at arch/x86/boot/Makefile, it does:
> 
> KBUILD_CFLAGS   := $(REALMODE_CFLAGS) -D_SETUP
> 
> and that _SETUP guard is kinda used to separate that early boot code
> from kernel proper.
> 
> And I wonder if adding such guard to arch/x86/boot/compressed/Makefile
> and then protect the asm goto check in arch/x86/include/asm/cpufeature.h
> with it, would be more in line with how this whole machinery should
> work...
> 

It overrides CFLAGS because it is by necessity a 32-bit compile (16
bits, really, but that's done at the assembly level only.)  Some 64-bit
flags cause the 32-bit compile to error out.

	-hpa


  reply	other threads:[~2018-09-28 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07 20:26 [PATCH] x86/boot: define CC_HAVE_ASM_GOTO Nick Desaulniers
2018-09-25 18:41 ` Nick Desaulniers
2018-09-25 19:08   ` Borislav Petkov
2018-09-25 21:08     ` Nick Desaulniers
2018-09-25 21:13       ` Nick Desaulniers
2018-09-26  9:08         ` Borislav Petkov
2018-09-28 20:41           ` H. Peter Anvin [this message]
2018-09-26  8:56       ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56442061-7f55-878d-5b26-7cdd14e901d2@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@suse.de \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.org \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).