Skip to content

Commit 1194e83

Browse files
amlutogregkh
authored andcommitted
x86/vdso: Only enable vDSO retpolines when enabled and supported
commit 4f16656 upstream. When I fixed the vDSO build to use inline retpolines, I messed up the Makefile logic and made it unconditional. It should have depended on CONFIG_RETPOLINE and on the availability of compiler support. This broke the build on some older compilers. Reported-by: nikola.ciprich@linuxbox.cz Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Rickard <matt@softrans.com.au> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: jason.vas.dias@gmail.com Cc: stable@vger.kernel.org Fixes: 2e549b2 ("x86/vdso: Fix vDSO build if a retpoline is emitted") Link: http://lkml.kernel.org/r/08a1f29f2c238dd1f493945e702a521f8a5aa3ae.1538540801.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 64ff574 commit 1194e83

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

arch/x86/entry/vdso/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso%.so $(obj)/vdso2c FORCE
7474
CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
7575
$(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \
7676
-fno-omit-frame-pointer -foptimize-sibling-calls \
77-
-DDISABLE_BRANCH_PROFILING -DBUILD_VDSO $(RETPOLINE_VDSO_CFLAGS)
77+
-DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
78+
79+
ifdef CONFIG_RETPOLINE
80+
ifneq ($(RETPOLINE_VDSO_CFLAGS),)
81+
CFL += $(RETPOLINE_VDSO_CFLAGS)
82+
endif
83+
endif
7884

7985
$(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL)
8086

@@ -153,7 +159,13 @@ KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector)
153159
KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
154160
KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
155161
KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
156-
KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
162+
163+
ifdef CONFIG_RETPOLINE
164+
ifneq ($(RETPOLINE_VDSO_CFLAGS),)
165+
KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
166+
endif
167+
endif
168+
157169
$(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
158170

159171
$(obj)/vdso32.so.dbg: FORCE \

0 commit comments

Comments
 (0)