[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMVonLjBcJm2DqyhybLjCDsm8P9jqSybvq0geDAfvbVn=P0N-g@mail.gmail.com>
Date: Wed, 4 Sep 2019 17:19:41 -0700
From: Vaibhav Rustagi <vaibhavrustagi@...gle.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Steve Wahl <steve.wahl@....com>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
russ.anderson@....com, dimitri.sivanich@....com,
mike.travis@....com, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>
Subject: Re: [PATCH 1/1] x86/purgatory: Change compiler flags to avoid
relocation errors.
On Wed, Sep 4, 2019 at 3:28 PM Vaibhav Rustagi
<vaibhavrustagi@...gle.com> wrote:
>
> On Wed, Sep 4, 2019 at 3:19 PM Nick Desaulniers <ndesaulniers@...gle.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@....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@....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@...gle.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.
>
I tried the changes and kdump was working.
> > 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
Powered by blists - more mailing lists