]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Signal #GP, not -EPERM, on bad WRMSR(MCi_CTL/STATUS)
authorSean Christopherson <seanjc@google.com>
Thu, 12 May 2022 22:27:14 +0000 (22:27 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 21:52:59 +0000 (14:52 -0700)
commitb911d7701e27a64d8a30c9bab4974fc21ccf54c7
tree1ff3322bc564100878eac4a18735de08c295e1d8
parent1f6d89c8e96cdab81e866ee99c0dca9b4f28b443
KVM: x86: Signal #GP, not -EPERM, on bad WRMSR(MCi_CTL/STATUS)

Return '1', not '-1', when handling an illegal WRMSR to a MCi_CTL or
MCi_STATUS MSR.  The behavior of "all zeros' or "all ones" for CTL MSRs
is architectural, as is the "only zeros" behavior for STATUS MSRs.  I.e.
the intent is to inject a #GP, not exit to userspace due to an unhandled
emulation case.  Returning '-1' gets interpreted as -EPERM up the stack
and effecitvely kills the guest.

Fixes: 5624ec74455f ("KVM: Add MCE support")
Fixes: f143e7d581a8 ("KVM: X86: #GP when guest attempts to write MCi_STATUS register w/o 0")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Link: https://lore.kernel.org/r/20220512222716.4112548-2-seanjc@google.com
arch/x86/kvm/x86.c