Commit 4340ba80 authored by Marc Zyngier's avatar Marc Zyngier

arm64: KVM: Move BP hardening vectors into .hyp.text section

There is no reason why the BP hardening vectors shouldn't be part
of the HYP text at compile time, rather than being mapped at runtime.

Also introduce a new config symbol that controls the compilation
of bpi.S.
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 7e80f637
...@@ -380,9 +380,7 @@ static inline void *kvm_get_hyp_vector(void) ...@@ -380,9 +380,7 @@ static inline void *kvm_get_hyp_vector(void)
static inline int kvm_map_vectors(void) static inline int kvm_map_vectors(void)
{ {
return create_hyp_mappings(kvm_ksym_ref(__bp_harden_hyp_vecs_start), return 0;
kvm_ksym_ref(__bp_harden_hyp_vecs_end),
PAGE_HYP_EXEC);
} }
#else #else
......
...@@ -54,9 +54,7 @@ arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o ...@@ -54,9 +54,7 @@ arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
arm64-obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o arm64-obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o
ifeq ($(CONFIG_KVM),y) arm64-obj-$(CONFIG_KVM_INDIRECT_VECTORS)+= bpi.o
arm64-obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) += bpi.o
endif
obj-y += $(arm64-obj-y) vdso/ probes/ obj-y += $(arm64-obj-y) vdso/ probes/
obj-m += $(arm64-obj-m) obj-m += $(arm64-obj-m)
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
ventry \target + 0x780 ventry \target + 0x780
.endm .endm
.text
.pushsection .hyp.text, "ax"
.align 11 .align 11
ENTRY(__bp_harden_hyp_vecs_start) ENTRY(__bp_harden_hyp_vecs_start)
.rept 4 .rept 4
...@@ -55,6 +59,8 @@ ENTRY(__bp_harden_hyp_vecs_start) ...@@ -55,6 +59,8 @@ ENTRY(__bp_harden_hyp_vecs_start)
.endr .endr
ENTRY(__bp_harden_hyp_vecs_end) ENTRY(__bp_harden_hyp_vecs_end)
.popsection
ENTRY(__qcom_hyp_sanitize_link_stack_start) ENTRY(__qcom_hyp_sanitize_link_stack_start)
stp x29, x30, [sp, #-16]! stp x29, x30, [sp, #-16]!
.rept 16 .rept 16
......
...@@ -57,6 +57,9 @@ config KVM_ARM_PMU ...@@ -57,6 +57,9 @@ config KVM_ARM_PMU
Adds support for a virtual Performance Monitoring Unit (PMU) in Adds support for a virtual Performance Monitoring Unit (PMU) in
virtual machines. virtual machines.
config KVM_INDIRECT_VECTORS
def_bool KVM && HARDEN_BRANCH_PREDICTOR
source drivers/vhost/Kconfig source drivers/vhost/Kconfig
endif # VIRTUALIZATION endif # VIRTUALIZATION
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment