linux/arch
Marc Zyngier 64eedcefd4 UPSTREAM: KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE
Injecting an exception into a guest with non-VHE is risky business.
Instead of writing in the shadow register for the switch code to
restore it, we override the CPU register instead. Which gets
overriden a few instructions later by said restore code.

The result is that although the guest correctly gets the exception,
it will return to the original context in some random state,
depending on what was there the first place... Boo.

Fix the issue by writing to the shadow register. The original code
is absolutely fine on VHE, as the state is already loaded, and writing
to the shadow register in that case would actually be a bug.

Bug: 254441685
Fixes: bb666c472c ("KVM: arm64: Inject AArch64 exceptions from HYP")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20220121184207.423426-1-maz@kernel.org
(cherry picked from commit 278583055a)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I5337f3d80d29b798b3cd078fe93fac666c4ae00c
2022-11-09 13:57:12 +00:00
..
alpha This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
arc ARC: entry: fix syscall_trace_exit argument 2022-04-27 13:53:55 +02:00
arm This is the 5.10.135 stable release 2022-08-04 10:59:03 +02:00
arm64 UPSTREAM: KVM: arm64: Use shadow SPSR_EL1 when injecting exceptions on !VHE 2022-11-09 13:57:12 +00:00
c6x
csky This is the 5.10.121 stable release 2022-07-23 16:10:22 +02:00
h8300
hexagon hexagon: clean up timer-regs.h 2021-11-26 10:39:19 +01:00
ia64 Merge 5.10.119 into android12-5.10-lts 2022-07-14 14:31:17 +02:00
m68k This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
microblaze This is the 5.10.110 stable release 2022-04-18 17:41:18 +02:00
mips This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 09:57:10 +02:00
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:41 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-09 10:20:55 +02:00
parisc This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
powerpc This is the 5.10.130 stable release 2022-07-28 17:04:30 +02:00
riscv This is the 5.10.134 stable release 2022-08-03 12:42:13 +02:00
s390 This is the 5.10.135 stable release 2022-08-04 10:59:03 +02:00
sh This is the 5.10.132 stable release 2022-07-28 17:17:55 +02:00
sparc Merge 5.10.119 into android12-5.10-lts 2022-07-14 14:31:17 +02:00
um This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
x86 BACKPORT: KVM: x86: avoid calling x86 emulator without a decoded instruction 2022-09-12 22:52:54 +00:00
xtensa This is the 5.10.127 stable release 2022-07-28 16:08:09 +02:00
.gitignore
Kconfig This is the 5.10.80 stable release 2021-11-19 11:50:41 +01:00