Message ID | 20250422210510.600354-2-ardb+git@google.com |
---|---|
State | New |
Headers | show |
Series | x86/boot: Disable jump tables in PIC code | expand |
On Wed, Apr 23, 2025 at 05:01:42PM +0200, Ard Biesheuvel wrote: > > > So let's not bother and disable jump tables for code built with -fPIC > > > under arch/x86/boot/startup. > > > > Hm, does objtool even run on boot code? > > > > This is about startup code, not boot code. This is code that is part > of vmlinux, but runs from a different mapping of memory than the one > the linker assumes, and so it needs to be built with -fPIC to > discourage the compiler and linker from inserting symbol references > via the kernel virtual mapping, which may not be up yet when this code > runs. Maybe objtool should ignore .head.text. It doesn't need ORC, static calls, uaccess validation, retpolines, etc.
diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile index e5f77e65c083..4062582144f6 100644 --- a/arch/x86/boot/startup/Makefile +++ b/arch/x86/boot/startup/Makefile @@ -5,6 +5,7 @@ KBUILD_CFLAGS += -D__DISABLE_EXPORTS -mcmodel=small -fPIC \ -Os -DDISABLE_BRANCH_PROFILING \ $(DISABLE_STACKLEAK_PLUGIN) \ -fno-stack-protector -D__NO_FORTIFY \ + -fno-jump-tables \ -include $(srctree)/include/linux/hidden.h # disable ftrace hooks and LTO