public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Relax canonical checks on some arch msrs
@ 2024-08-02 15:16 Maxim Levitsky
  2024-08-02 15:16 ` [PATCH v2 1/2] KVM: x86: relax canonical check for some x86 architectural msrs Maxim Levitsky
  2024-08-02 15:16 ` [PATCH v2 2/2] KVM: SVM: fix emulation of msr reads/writes of MSR_FS_BASE and MSR_GS_BASE Maxim Levitsky
  0 siblings, 2 replies; 9+ messages in thread
From: Maxim Levitsky @ 2024-08-02 15:16 UTC (permalink / raw)
  To: kvm
  Cc: Sean Christopherson, linux-kernel, Borislav Petkov,
	H. Peter Anvin, Paolo Bonzini, Ingo Molnar, x86, Thomas Gleixner,
	Dave Hansen, Maxim Levitsky

Recently we came up upon a failure where likely the guest writes
0xff4547ceb1600000 to MSR_KERNEL_GS_BASE and later on, qemu
sets this value via KVM_PUT_MSRS, and is rejected by the
kernel, likely due to not being canonical in 4 level paging.

I did some reverse engineering and to my surprise I found out
that both Intel and AMD have very loose checks in regard to
non canonical addresses written to this and several other msrs,
when the CPU supports 5 level paging.

Patch #1 addresses this, making KVM tolerate this.

Patch #2 is just a fix for a semi theoretical bug, found
while trying to debug the issue.

V2: addressed a very good feedback from Chao Gao. Thanks!

Best regards,
	Maxim Levitsky

Maxim Levitsky (2):
  KVM: x86: relax canonical check for some x86 architectural msrs
  KVM: SVM: fix emulation of msr reads/writes of MSR_FS_BASE and
    MSR_GS_BASE

 arch/x86/kvm/svm/svm.c | 12 ++++++++++++
 arch/x86/kvm/x86.c     | 11 ++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

-- 
2.40.1



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

end of thread, other threads:[~2024-08-05 20:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 15:16 [PATCH v2 0/2] Relax canonical checks on some arch msrs Maxim Levitsky
2024-08-02 15:16 ` [PATCH v2 1/2] KVM: x86: relax canonical check for some x86 architectural msrs Maxim Levitsky
2024-08-02 15:53   ` Sean Christopherson
2024-08-05  6:12     ` Chao Gao
2024-08-05 11:01     ` mlevitsk
2024-08-05 16:39       ` Sean Christopherson
2024-08-05 18:07         ` mlevitsk
2024-08-05 20:54           ` Sean Christopherson
2024-08-02 15:16 ` [PATCH v2 2/2] KVM: SVM: fix emulation of msr reads/writes of MSR_FS_BASE and MSR_GS_BASE Maxim Levitsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox