linux-stable/arch
Sean Christopherson 836b131683 KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest
[ Upstream commit c4abd73520 ]

Stuff CR0 and/or CR4 to be compliant with a restricted guest if and only
if KVM itself is not configured to utilize unrestricted guests, i.e. don't
stuff CR0/CR4 for a restricted L2 that is running as the guest of an
unrestricted L1.  Any attempt to VM-Enter a restricted guest with invalid
CR0/CR4 values should fail, i.e. in a nested scenario, KVM (as L0) should
never observe a restricted L2 with incompatible CR0/CR4, since nested
VM-Enter from L1 should have failed.

And if KVM does observe an active, restricted L2 with incompatible state,
e.g. due to a KVM bug, fudging CR0/CR4 instead of letting VM-Enter fail
does more harm than good, as KVM will often neglect to undo the side
effects, e.g. won't clear rmode.vm86_active on nested VM-Exit, and thus
the damage can easily spill over to L1.  On the other hand, letting
VM-Enter fail due to bad guest state is more likely to contain the damage
to L2 as KVM relies on hardware to perform most guest state consistency
checks, i.e. KVM needs to be able to reflect a failed nested VM-Enter into
L1 irrespective of (un)restricted guest behavior.

Cc: Jim Mattson <jmattson@google.com>
Cc: stable@vger.kernel.org
Fixes: bddd82d19e ("KVM: nVMX: KVM needs to unset "unrestricted guest" VM-execution control in vmcs02 if vmcs12 doesn't set it")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230613203037.1968489-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-11 11:57:43 +02:00
..
alpha init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
arc ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-27 08:44:00 +02:00
arm ARM: cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
arm64 arm64: mm: fix VA-range sanity check 2023-07-27 08:44:37 +02:00
c6x c6x: add support for TIF_NOTIFY_SIGNAL 2023-01-04 11:39:21 +01:00
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
m68k m68k/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips mips/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:45:37 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:48:03 +02:00
parisc init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
powerpc init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
riscv riscv, bpf: Fix inconsistent JIT image generation 2023-07-27 08:44:23 +02:00
s390 KVM: s390: pv: fix index value of replaced ASCE 2023-08-11 11:57:31 +02:00
sh sh/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:37 +02:00
um um/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:37 +02:00
x86 KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest 2023-08-11 11:57:43 +02:00
xtensa init: Remove check_bugs() leftovers 2023-08-08 19:57:37 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00