From: Vaibhav Rustagi <vaibhavrustagi@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Steve Wahl <steve.wahl@hpe.com>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>,
russ.anderson@hpe.com, dimitri.sivanich@hpe.com,
mike.travis@hpe.com, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>
Subject: Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors.
Date: Wed, 4 Sep 2019 15:28:01 -0700 [thread overview]
Message-ID: <CAMVonLiOB4PnbnLGo9gP8MK8kGd_e9vW_t+GOPuHMO_RqmkKNA@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdnX3qVq1wGovViyGJSnySKzCATU4SU_ASsL-9XfDZ8+Eg@mail.gmail.com>
On Wed, Sep 4, 2019 at 3:19 PM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> + (folks recommended by ./scripts/get_maintainer.pl <patchfile>)
> (See also, step 7:
> https://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patch-to-the-linux-kernel-and-responding-to-feedback/)
>
> On Wed, Sep 4, 2019 at 2:45 PM Steve Wahl <steve.wahl@hpe.com> wrote:
> >
> > The last change to this Makefile caused relocation errors when loading
>
> It's good to add a fixes tag like below when a patch fixes a
> regression, so that stable backports the fix as far back as the
> regression:
> Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than
> reset KBUILD_CFLAGS")
>
> > a kdump kernel. This change restores the appropriate flags, without
> > reverting to the former practice of resetting KBUILD_CFLAGS.
> >
> > Signed-off-by: Steve Wahl <steve.wahl@hpe.com>
> > ---
> > arch/x86/purgatory/Makefile | 35 +++++++++++++++++++----------------
> > 1 file changed, 19 insertions(+), 16 deletions(-)
> >
> > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
> > index 8901a1f89cf5..9f0bfef1f5db 100644
> > --- a/arch/x86/purgatory/Makefile
> > +++ b/arch/x86/purgatory/Makefile
> > @@ -18,37 +18,40 @@ targets += purgatory.ro
> > KASAN_SANITIZE := n
> > KCOV_INSTRUMENT := n
> >
> > +# These are adjustments to the compiler flags used for objects that
> > +# make up the standalone porgatory.ro
> > +
> > +PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
> > +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
>
> Thanks for confirming the fix. While it sounds like -mcmodel=large is
> the only necessary change, I don't object to -ffreestanding of
> -fno-zero-initialized-in-bss being readded, especially since I think
> what you've done with PURGATORY_CFLAGS_REMOVE is more concise.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Vaibhav, do you still have an environment setup to quickly test this
> again w/ Clang builds?
I will setup the environment and will try the changes.
> Tglx, we'll likely want to get this into 5.3 if it's not too late (I
> saw Miguel Ojeda mention there might be an -rc8)?
>
> > +
> > # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
> > # in turn leaves some undefined symbols like __fentry__ in purgatory and not
> > # sure how to relocate those.
> > ifdef CONFIG_FUNCTION_TRACER
> > -CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE)
> > -CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE)
> > -CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE)
> > -CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE)
> > +PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_FTRACE)
> > endif
> >
> > ifdef CONFIG_STACKPROTECTOR
> > -CFLAGS_REMOVE_sha256.o += -fstack-protector
> > -CFLAGS_REMOVE_purgatory.o += -fstack-protector
> > -CFLAGS_REMOVE_string.o += -fstack-protector
> > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector
> > +PURGATORY_CFLAGS_REMOVE += -fstack-protector
> > endif
> >
> > ifdef CONFIG_STACKPROTECTOR_STRONG
> > -CFLAGS_REMOVE_sha256.o += -fstack-protector-strong
> > -CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong
> > -CFLAGS_REMOVE_string.o += -fstack-protector-strong
> > -CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong
> > +PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong
> > endif
> >
> > ifdef CONFIG_RETPOLINE
> > -CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS)
> > -CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS)
> > -CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS)
> > -CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS)
> > +PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS)
> > endif
> >
> > +CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE)
> > +CFLAGS_purgatory.o += $(PURGATORY_CFLAGS)
> > +
> > +CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE)
> > +CFLAGS_sha256.o += $(PURGATORY_CFLAGS)
> > +
> > +CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE)
> > +CFLAGS_string.o += $(PURGATORY_CFLAGS)
> > +
> > $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
> > $(call if_changed,ld)
> >
> > --
> > 2.12.3
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
next prev parent reply other threads:[~2019-09-04 22:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 21:45 [PATCH 1/1] x86/purgatory: Change compiler flags to avoid relocation errors Steve Wahl
2019-09-04 22:18 ` Nick Desaulniers
2019-09-04 22:28 ` Vaibhav Rustagi [this message]
2019-09-05 0:19 ` Vaibhav Rustagi
2019-09-05 0:23 ` Nick Desaulniers
2019-09-04 22:53 ` Randy Dunlap
2019-09-05 5:34 ` Andreas Smas
2019-09-05 18:19 ` Nick Desaulniers
2019-09-05 20:00 ` Andreas Smas
2019-09-05 9:15 ` Borislav Petkov
2019-09-05 15:07 ` Steve Wahl
2019-09-05 16:46 ` 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=CAMVonLiOB4PnbnLGo9gP8MK8kGd_e9vW_t+GOPuHMO_RqmkKNA@mail.gmail.com \
--to=vaibhavrustagi@google.com \
--cc=bp@alien8.de \
--cc=clang-built-linux@googlegroups.com \
--cc=dimitri.sivanich@hpe.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.travis@hpe.com \
--cc=mingo@redhat.com \
--cc=ndesaulniers@google.com \
--cc=russ.anderson@hpe.com \
--cc=steve.wahl@hpe.com \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).