arm64: Unconditionally select CONFIG_JUMP_LABEL
PATCH 1/1 arm64: Unconditionally select CONFIG_JUMP_LABEL
Aneesh reports that his kernel fails to boot in nVHE mode with KVM's protected mode enabled. Further investigation by Mostafa reveals that this fails because CONFIG_JUMP_LABEL=n and that we have static keys shared between EL1 and EL2.
While this can be worked around, it is obvious that we have long relied on having CONFIG_JUMP_LABEL enabled at all times, as all supported compilers now have 'asm goto' (which is the basic block for jump labels).
Let's simplify our lives once and for all by mandating jump labels. It's not like anyone else is testing anything without them, and we already rely on them for other things (kfence, xfs, preempt).
--- arch/arm64/Kconfig | 1 + arch/arm64/kernel/Makefile | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/Kconfig +1 -0
@@ -256,6 +256,7 @@ config ARM64 select HOTPLUG_SMT if HOTPLUG_CPU select IRQ_DOMAIN select IRQ_FORCED_THREADING + select JUMP_LABEL select KASAN_VMALLOC if KASAN select LOCK_MM_AND_FIND_VMA select MODULES_USE_ELF_RELA
arch/arm64/kernel/Makefile +1 -2
@@ -34,7 +34,7 @@ obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ cpufeature.o alternative.o cacheinfo.o \ smp.o smp_spin_table.o topology.o smccc-call.o \ syscall.o proton-pack.o idle.o patching.o pi/ \ - rsi.o + rsi.o jump_label.o obj-$(CONFIG_COMPAT) += sys32.o signal32.o \ sys_compat.o
@@ -47,7 +47,6 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_hld.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_CPU_PM) += sleep.o suspend.o -obj-$(CONFIG_JUMP_LABEL) += jump_label.o obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_EFI) += efi.o efi-rt-wrapper.o obj-$(CONFIG_PCI) += pci.o
Signature · 1 line
2.39.2
Quoted 14 lines · Marc Zyngier
Aneesh reports that his kernel fails to boot in nVHE mode with KVM's protected mode enabled. Further investigation by Mostafa reveals that this fails because
CONFIG_JUMP_LABEL=nand that we have static keys shared between EL1 and EL2.While this can be worked around, it is obvious that we have long relied on having
CONFIG_JUMP_LABELenabled at all times, as all supported compilers now have 'asm goto' (which is the basic block for jump labels).Let's simplify our lives once and for all by mandating jump labels. It's not like anyone else is testing anything without them, and we already rely on them for other things (kfence, xfs, preempt).
Quoted 8 lines
Reported-by "Aneesh Kumar K.V" <[email protected]>Reported-by Mostafa Saleh <[email protected]>Signed-off-by Marc Zyngier <[email protected]>Cc Will Deacon <[email protected]>Cc Catalin marinas <[email protected]>Cc Mark Rutland <[email protected]>Cc Ard Biesheuvel <[email protected]>
It might be worth noting that even with this, we still need to take care to not use arbitrary static keys in hyp code (since we don't to consume anything that can legitimately be flipped after hyp initialization), but that aspect should be dealt with by reviewing additions to image-vars.h.
Mark.
Quoted 41 lines
--- arch/arm64/Kconfig | 1 + arch/arm64/kernel/Makefile | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm64/Kconfig +1
-0@@ -256,6 +256,7 @@ config ARM64 select HOTPLUG_SMT if HOTPLUG_CPU select IRQ_DOMAIN select IRQ_FORCED_THREADING + select JUMP_LABEL select KASAN_VMALLOC if KASAN select LOCK_MM_AND_FIND_VMA select MODULES_USE_ELF_RELAarch/arm64/kernel/Makefile +1
-2@@ -34,7 +34,7 @@ obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ cpufeature.o alternative.o cacheinfo.o \ smp.o smp_spin_table.o topology.o smccc-call.o \ syscall.o proton-pack.o idle.o patching.o pi/ \ - rsi.o + rsi.o jump_label.o obj-$(CONFIG_COMPAT) += sys32.o signal32.o \ sys_compat.o@@ -47,7 +47,6 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_hld.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_CPU_PM) += sleep.o suspend.o -obj-$(CONFIG_JUMP_LABEL) += jump_label.o obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_EFI) += efi.o efi-rt-wrapper.o obj-$(CONFIG_PCI) += pci.oSignature · 1 line
2.39.2
Will Deacon
maintainerQuoted 24 lines · Mark Rutland
Quoted 14 lines · Marc Zyngier
Aneesh reports that his kernel fails to boot in nVHE mode with KVM's protected mode enabled. Further investigation by Mostafa reveals that this fails because
CONFIG_JUMP_LABEL=nand that we have static keys shared between EL1 and EL2.While this can be worked around, it is obvious that we have long relied on having
CONFIG_JUMP_LABELenabled at all times, as all supported compilers now have 'asm goto' (which is the basic block for jump labels).Let's simplify our lives once and for all by mandating jump labels. It's not like anyone else is testing anything without them, and we already rely on them for other things (kfence, xfs, preempt).
Quoted 8 lines
Reported-by "Aneesh Kumar K.V" <[email protected]>Reported-by Mostafa Saleh <[email protected]>Signed-off-by Marc Zyngier <[email protected]>Cc Will Deacon <[email protected]>Cc Catalin marinas <[email protected]>Cc Mark Rutland <[email protected]>Cc Ard Biesheuvel <[email protected]>
Quoted 6 lines
Acked-by Mark Rutland <[email protected]>It might be worth noting that even with this, we still need to take care to not use arbitrary static keys in hyp code (since we don't to consume anything that can legitimately be flipped after hyp initialization), but that aspect should be dealt with by reviewing additions to
image-vars.h.
Right, we should probably try to re-use the static key sealing mechanism used for the handling of __ro_after_init keys so that the host doesn't try to patch the hyp text after de-privilege (which will result in a panic).
Will
Quoted 11 lines · Marc Zyngier
Aneesh reports that his kernel fails to boot in nVHE mode with KVM's protected mode enabled. Further investigation by Mostafa reveals that this fails because
CONFIG_JUMP_LABEL=nand that we have static keys shared between EL1 and EL2.While this can be worked around, it is obvious that we have long relied on having
CONFIG_JUMP_LABELenabled at all times, as all supported compilers now have 'asm goto' (which is the basic block for jump labels).[...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64: Unconditionally select CONFIG_JUMP_LABEL
https://git.kernel.org/arm64/c/727c2a53cf95
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev