Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/nospec: build expoline.o for modules_prepare target

When CONFIG_EXPOLINE_EXTERN is used expoline thunks are generated
from arch/s390/lib/expoline.S and postlinked into every module.
This is also true for external modules. Add expoline.o build to
the modules_prepare target.

Fixes: 1d2ad084800e ("s390/nospec: add an option to use thunk-extern")
Reported-by: Joe Lawrence <joe.lawrence@redhat.com>
Tested-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Tested-by: C. Erastus Toe <ctoe@redhat.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Link: https://lore.kernel.org/r/patch-1.thread-d13b6c.git-a2387a74dc49.your-ad-here.call-01656331067-ext-4899@work.hours
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

authored by

Vasily Gorbik and committed by
Alexander Gordeev
c4e78957 d7d488f4

+12 -2
+7 -1
arch/s390/Makefile
··· 82 82 83 83 ifdef CONFIG_EXPOLINE 84 84 ifdef CONFIG_EXPOLINE_EXTERN 85 - KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline.o 85 + KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline/expoline.o 86 86 CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern 87 87 CC_FLAGS_EXPOLINE += -mfunction-return=thunk-extern 88 88 else ··· 163 163 $(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h 164 164 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ 165 165 $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) 166 + 167 + ifdef CONFIG_EXPOLINE_EXTERN 168 + modules_prepare: expoline_prepare 169 + expoline_prepare: prepare0 170 + $(Q)$(MAKE) $(build)=arch/s390/lib/expoline arch/s390/lib/expoline/expoline.o 171 + endif 166 172 endif 167 173 168 174 # Don't use tabs in echo arguments
+2 -1
arch/s390/lib/Makefile
··· 7 7 obj-y += mem.o xor.o 8 8 lib-$(CONFIG_KPROBES) += probes.o 9 9 lib-$(CONFIG_UPROBES) += probes.o 10 - obj-$(CONFIG_EXPOLINE_EXTERN) += expoline.o 11 10 obj-$(CONFIG_S390_KPROBES_SANITY_TEST) += test_kprobes_s390.o 12 11 test_kprobes_s390-objs += test_kprobes_asm.o test_kprobes.o 13 12 ··· 21 22 obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o 22 23 23 24 lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o 25 + 26 + obj-$(CONFIG_EXPOLINE_EXTERN) += expoline/
arch/s390/lib/expoline.S arch/s390/lib/expoline/expoline.S
+3
arch/s390/lib/expoline/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + obj-y += expoline.o