Messages in this thread | | | Date | Thu, 6 Feb 2020 03:52:54 -0800 | From | Kees Cook <> | Subject | Re: [RFC PATCH 05/11] x86: Makefile: Add build and config option for CONFIG_FG_KASLR |
| |
On Thu, Feb 06, 2020 at 11:30:55AM +0100, Peter Zijlstra wrote: > On Wed, Feb 05, 2020 at 02:39:44PM -0800, Kristen Carlson Accardi wrote: > > Allow user to select CONFIG_FG_KASLR if dependencies are met. Change > > the make file to build with -ffunction-sections if CONFIG_FG_KASLR > > > > Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com> > > --- > > Makefile | 4 ++++ > > arch/x86/Kconfig | 13 +++++++++++++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/Makefile b/Makefile > > index c50ef91f6136..41438a921666 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -846,6 +846,10 @@ ifdef CONFIG_LIVEPATCH > > KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) > > endif > > > > +ifdef CONFIG_FG_KASLR > > +KBUILD_CFLAGS += -ffunction-sections > > +endif > [...] > In particular: > > "They prevent optimizations by the compiler and assembler using > relative locations inside a translation unit since the locations are > unknown until link time."
I think this mainly a feature of this flag, since it's those relocations that are used to do the post-shuffle fixups. But yes, I would imagine this has some negative impact on code generation.
> I suppose in practise this only means tail-calls are affected and will > no longer use JMP.d8. Or are more things affected?
It's worth looking at. I'm also curious to see how this will interact with Link Time Optimization.
-- Kees Cook
| |