2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-07 05:04:04 +08:00
linux-next/arch/arm64/kvm
Mark Rutland db85c55f1b arm64: kvm: restore EL1N SP for panic
If we panic in hyp mode, we inject a call to panic() into the EL1N host
kernel. If a guest context is active, we first attempt to restore the
minimal amount of state necessary to execute the host kernel with
restore_sysregs.

However, the SP is restored as part of restore_common_regs, and so we
may return to the host's panic() function with the SP of the guest. Any
calculations based on the SP will be bogus, and any attempt to access
the stack will result in recursive data aborts.

When running Linux as a guest, the guest's EL1N SP is like to be some
valid kernel address. In this case, the host kernel may use that region
as a stack for panic(), corrupting it in the process.

Avoid the problem by restoring the host SP prior to returning to the
host. To prevent misleading backtraces in the host, the FP is zeroed at
the same time. We don't need any of the other "common" registers in
order to panic successfully.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: <kvmarm@lists.cs.columbia.edu>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2015-10-22 23:01:48 +02:00
..
debug.c KVM: arm64: add trace points for guest_debug debug 2015-07-21 12:50:43 +01:00
emulate.c arm64: kvm: move to ESR_ELx macros 2015-01-15 12:24:25 +00:00
guest.c arm64/kvm: Add generic v8 KVM target 2015-08-12 11:28:22 +01:00
handle_exit.c KVM: arm64: enable KVM_CAP_SET_GUEST_DEBUG 2015-07-21 12:50:43 +01:00
hyp-init.S arm64: KVM: use ID map with increased VA range if required 2015-03-23 11:35:29 +00:00
hyp.S arm64: kvm: restore EL1N SP for panic 2015-10-22 23:01:48 +02:00
inject_fault.c arm64: KVM: Fix host crash when injecting a fault into a 32bit guest 2015-08-27 16:16:55 +01:00
Kconfig arm/arm64: KVM : Enable vhost device selection under KVM config menu 2015-10-22 23:01:45 +02:00
Makefile KVM: arm: introduce kvm_arm_init/setup/clear_debug 2015-07-21 12:47:08 +01:00
regmap.c arm64: KVM: 32bit GP register access 2013-06-12 16:42:14 +01:00
reset.c KVM: arm/arm64: timer: Allow the timer to control the active state 2015-08-12 11:28:26 +01:00
sys_regs_generic_v8.c arm64/kvm: Add generic v8 KVM target 2015-08-12 11:28:22 +01:00
sys_regs.c arm64: KVM: Remove all traces of the ThumbEE registers 2015-09-17 13:13:26 +01:00
sys_regs.h KVM: arm64: introduce vcpu->arch.debug_ptr 2015-07-21 12:50:25 +01:00
trace.h KVM: arm64: add trace points for guest_debug debug 2015-07-21 12:50:43 +01:00
vgic-v2-switch.S arm/arm64: KVM: vgic: Do not save GICH_HCR / ICH_HCR_EL2 2015-06-17 09:59:55 +01:00
vgic-v3-switch.S arm/arm64: KVM: vgic: Do not save GICH_HCR / ICH_HCR_EL2 2015-06-17 09:59:55 +01:00