linux/arch/arm64/kvm
Dave Martin 2955bcc8c3 KVM: arm64: Avoid mistaken attempts to save SVE state for vcpus
Commit e6b673b ("KVM: arm64: Optimise FPSIMD handling to reduce
guest/host thrashing") uses fpsimd_save() to save the FPSIMD state
for a vcpu when scheduling the vcpu out.  However, currently
current's value of TIF_SVE is restored before calling fpsimd_save()
which means that fpsimd_save() may erroneously attempt to save SVE
state from the vcpu.  This enables current's vector state to be
polluted with guest data.  current->thread.sve_state may be
unallocated or not large enough, so this can also trigger a NULL
dereference or buffer overrun.

Instead of this, TIF_SVE should be configured properly for the
guest when calling fpsimd_save() with the vcpu context loaded.

This patch ensures this by delaying restoration of current's
TIF_SVE until after the call to fpsimd_save().

Fixes: e6b673b741 ("KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2018-06-21 09:14:44 +01:00
..
hyp Small update for KVM. 2018-06-12 11:34:04 -07:00
debug.c KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags 2018-05-25 12:28:13 +01:00
fpsimd.c KVM: arm64: Avoid mistaken attempts to save SVE state for vcpus 2018-06-21 09:14:44 +01:00
guest.c arm/arm64: KVM: Add PSCI version selection API 2018-04-20 16:32:23 +01:00
handle_exit.c
hyp-init.S arm64: KVM: Move vector offsetting from hyp-init.S to kvm_get_hyp_vector 2018-03-19 13:05:37 +00:00
hyp.S
inject_fault.c
irq.h
Kconfig KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing 2018-05-25 12:28:28 +01:00
Makefile KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing 2018-05-25 12:28:28 +01:00
regmap.c
reset.c arm64: KVM: Add ARCH_WORKAROUND_2 discovery through ARCH_FEATURES_FUNC_ID 2018-05-31 18:00:59 +01:00
sys_regs_generic_v8.c
sys_regs.c KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags 2018-05-25 12:28:13 +01:00
sys_regs.h
trace.h
va_layout.c arm64: KVM: Allow mapping of vectors outside of the RAM region 2018-03-19 13:06:46 +00:00
vgic-sys-reg-v3.c