mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ross Burton <ross.burton@intel.com>
Cc: x86-ml <x86@kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch/x86/boot: use prefix map to avoid embedded paths
Date: Thu, 26 Sep 2019 11:25:30 +0200	[thread overview]
Message-ID: <20190926092530.GA18383@zn.tnic> (raw)
In-Reply-To: <20190926091132.3845-1-ross.burton@intel.com>

Don't forget to CC: lkml and x86@kernel.org on x86 patches.

On Thu, Sep 26, 2019 at 10:11:32AM +0100, Ross Burton wrote:
> From: Bruce Ashfield <bruce.ashfield@gmail.com>
> 
> It was observed that the kernel embeds the path in the x86 boot
> artifacts.
> 
> From https://bugzilla.yoctoproject.org/show_bug.cgi?id=13458:
> 
> [
>    If you turn on the buildpaths QA test, or try a reproducible build, you
>    discover that the kernel image contains build paths.
> 
>    $ strings bzImage-5.0.19-yocto-standard |grep tmp/
>    out of pgt_buf in
>    /data/poky-tmp/reproducible/tmp/work-shared/qemux86-64/kernel-source/arch/x86/boot/compressed/kaslr_64.c!?
> 
>    But what's this in the top-level Makefile:
> 
>    $ git grep prefix-map
>    Makefile:KBUILD_CFLAGS  += $(call
>    cc-option,-fmacro-prefix-map=$(srctree)/=)
> 
>    So the __FILE__ shouldn't be using the full path.  However
>    arch/x86/boot/compressed/Makefile has this:
> 
>    KBUILD_CFLAGS := -m$(BITS) -O2
> 
>    So that clears KBUILD_FLAGS, removing the -fmacro-prefix-map option.
> ]
> 
> Other architectures do not clear the flags, but instead prune before
> adding boot or specific options. There's no obvious reason why x86 isn't
> doing the same thing (pruning vs clearing) and no build or boot issues
> have been observed.
> 
> So we make x86 can do the same thing, and we no longer have embedded paths.
> 
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>  arch/x86/boot/compressed/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 6b84afdd7538..b246f18c5857 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -38,6 +38,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
>  KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
>  KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
>  KBUILD_CFLAGS += -Wno-pointer-sign
> +KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
>  
>  KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
>  GCOV_PROFILE := n
> -- 

What about arch/x86/boot/Makefile ?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

       reply	other threads:[~2019-09-26  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190926091132.3845-1-ross.burton@intel.com>
2019-09-26  9:25 ` Borislav Petkov [this message]
2019-09-26  9:11 Ross Burton

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=20190926092530.GA18383@zn.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ross.burton@intel.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®