linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] SMM emulation and interrupt shadow fixes
@ 2022-06-21 15:08 Maxim Levitsky
  2022-06-21 15:08 ` [PATCH v2 01/11] KVM: x86: emulator: em_sysexit should update ctxt->mode Maxim Levitsky
                   ` (12 more replies)
  0 siblings, 13 replies; 44+ messages in thread
From: Maxim Levitsky @ 2022-06-21 15:08 UTC (permalink / raw)
  To: kvm
  Cc: Sean Christopherson, x86, Kees Cook, Dave Hansen, linux-kernel,
	H. Peter Anvin, Borislav Petkov, Joerg Roedel, Ingo Molnar,
	Paolo Bonzini, Thomas Gleixner, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Maxim Levitsky

This patch series is a result of long debug work to find out why
sometimes guests with win11 secure boot
were failing during boot.

During writing a unit test I found another bug, turns out
that on rsm emulation, if the rsm instruction was done in real
or 32 bit mode, KVM would truncate the restored RIP to 32 bit.

I also refactored the way we write SMRAM so it is easier
now to understand what is going on.

The main bug in this series which I fixed is that we
allowed #SMI to happen during the STI interrupt shadow,
and we did nothing to both reset it on #SMI handler
entry and restore it on RSM.

Best regards,
	Maxim Levitsky

Maxim Levitsky (11):
  KVM: x86: emulator: em_sysexit should update ctxt->mode
  KVM: x86: emulator: introduce update_emulation_mode
  KVM: x86: emulator: remove assign_eip_near/far
  KVM: x86: emulator: update the emulation mode after rsm
  KVM: x86: emulator: update the emulation mode after CR0 write
  KVM: x86: emulator/smm: number of GPRs in the SMRAM image depends on
    the image format
  KVM: x86: emulator/smm: add structs for KVM's smram layout
  KVM: x86: emulator/smm: use smram struct for 32 bit smram load/restore
  KVM: x86: emulator/smm: use smram struct for 64 bit smram load/restore
  KVM: x86: SVM: use smram structs
  KVM: x86: emulator/smm: preserve interrupt shadow in SMRAM

 arch/x86/include/asm/kvm_host.h |   6 -
 arch/x86/kvm/emulate.c          | 305 ++++++++++++++++----------------
 arch/x86/kvm/kvm_emulate.h      | 146 +++++++++++++++
 arch/x86/kvm/svm/svm.c          |  28 +--
 arch/x86/kvm/x86.c              | 162 ++++++++---------
 5 files changed, 394 insertions(+), 253 deletions(-)

-- 
2.26.3



^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2022-07-21 14:57 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 15:08 [PATCH v2 00/11] SMM emulation and interrupt shadow fixes Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 01/11] KVM: x86: emulator: em_sysexit should update ctxt->mode Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 02/11] KVM: x86: emulator: introduce update_emulation_mode Maxim Levitsky
2022-07-20 23:44   ` Sean Christopherson
2022-07-21 11:52     ` Maxim Levitsky
2022-07-21 14:23       ` Sean Christopherson
2022-06-21 15:08 ` [PATCH v2 03/11] KVM: x86: emulator: remove assign_eip_near/far Maxim Levitsky
2022-07-20 23:51   ` Sean Christopherson
2022-07-21 11:52     ` Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 04/11] KVM: x86: emulator: update the emulation mode after rsm Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 05/11] KVM: x86: emulator: update the emulation mode after CR0 write Maxim Levitsky
2022-07-20 23:50   ` Sean Christopherson
2022-07-21 11:53     ` Maxim Levitsky
2022-07-21 14:11       ` Sean Christopherson
2022-07-21 14:57         ` Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 06/11] KVM: x86: emulator/smm: number of GPRs in the SMRAM image depends on the image format Maxim Levitsky
2022-07-21  0:06   ` Sean Christopherson
2022-07-21  0:09     ` Sean Christopherson
2022-06-21 15:08 ` [PATCH v2 07/11] KVM: x86: emulator/smm: add structs for KVM's smram layout Maxim Levitsky
2022-07-21  0:40   ` Sean Christopherson
2022-07-21 11:54     ` Maxim Levitsky
2022-06-21 15:08 ` [PATCH v2 08/11] KVM: x86: emulator/smm: use smram struct for 32 bit smram load/restore Maxim Levitsky
2022-06-21 15:09 ` [PATCH v2 09/11] KVM: x86: emulator/smm: use smram struct for 64 " Maxim Levitsky
2022-07-21  0:38   ` Sean Christopherson
2022-07-21 11:54     ` Maxim Levitsky
2022-06-21 15:09 ` [PATCH v2 10/11] KVM: x86: SVM: use smram structs Maxim Levitsky
2022-07-21  0:18   ` Sean Christopherson
2022-07-21 11:54     ` Maxim Levitsky
2022-07-21  0:39   ` Sean Christopherson
2022-07-21 11:54     ` Maxim Levitsky
2022-06-21 15:09 ` [PATCH v2 11/11] KVM: x86: emulator/smm: preserve interrupt shadow in SMRAM Maxim Levitsky
2022-06-29 16:31   ` Jim Mattson
2022-06-30  6:00     ` Maxim Levitsky
2022-06-30 16:00       ` Jim Mattson
2022-07-05 13:38         ` Maxim Levitsky
2022-07-05 13:40           ` Maxim Levitsky
2022-07-05 13:51             ` Maxim Levitsky
2022-07-06 18:13           ` Jim Mattson
2022-07-06 20:00             ` Maxim Levitsky
2022-07-06 20:38               ` Jim Mattson
2022-07-10 16:05                 ` Maxim Levitsky
2022-06-29  7:21 ` [PATCH v2 00/11] SMM emulation and interrupt shadow fixes Maxim Levitsky
2022-07-14 11:06 ` Maxim Levitsky
2022-07-20  8:47   ` Maxim Levitsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).