Skip to content

KVM: x86: Emulator MMIO fix and cleanups

Sean Christopherson kvm linux-coco lkml 1 version Applied

Status from this message: Applied to kvm-x86 mmio, with the hardened version of the helper in patch 14.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 10 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/14KVM: x86: Use scratch field in MMIO fragment to hold small write valuesarch/x86/kvm/x86.c include/linux/kvm_host.h+15 -20 replies
2/14KVM: x86: Open code handling of completed MMIO reads in emulator_read_write()arch/x86/kvm/emulate.c arch/x86/kvm/x86.c+29 -170 replies
3/14KVM: x86: Trace unsatisfied MMIO reads on a per-page basisarch/x86/kvm/x86.c+8 -10 replies
4/14KVM: x86: Use local MMIO fragment variable to clean up emulator_read_write()arch/x86/kvm/x86.c+5 -60 replies
5/14KVM: x86: Open code read vs. write userspace MMIO exits in emulator_read_write()arch/x86/kvm/x86.c+13 -200 replies
6/14KVM: x86: Move MMIO write tracing into vcpu_mmio_write()arch/x86/kvm/x86.c+5 -80 replies
7/14KVM: x86: Harden SEV-ES MMIO against on-stack use-after-freearch/x86/kvm/x86.c+6 -40 replies
8/14KVM: x86: Dedup kvm_sev_es_mmio_{read,write}()arch/x86/kvm/x86.c+45 -650 replies
9/14KVM: x86: Consolidate SEV-ES MMIO emulation into a single public APIarch/x86/kvm/svm/sev.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+17 -380 replies
10/14KVM: x86: Bury emulator read/write ops in emulator_{read,write}_emulated()arch/x86/kvm/x86.c+14 -150 replies
11/14KVM: x86: Fold emulator_write_phys() into write_emulate()arch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+7 -160 replies
12/14KVM: x86: Rename .read_write_emulate() to .read_write_guest()arch/x86/kvm/x86.c+28 -100 replies
13/14KVM: x86: Don't panic the kernel if completing userspace I/O / MMIO goes sidewaysarch/x86/kvm/x86.c+8 -40 replies
14/14KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exitarch/x86/kvm/vmx/tdx.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+36 -446 replies

Reviews trailers per patch

None of the 14 patches has a Reviewed-by or Acked-by.

PatchRick EdgecombeTom Lendacky
SeriesT-b T-b
1/14
2/14
3/14
4/14
5/14
6/14
7/14
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] KVM: x86: Emulator MMIO fix and cleanups

Fix a UAF stack bug where KVM references a stack pointer around an exit to userspace, and then clean up the related code to try to make it easier to maintain (not necessarily "easy", but "easier").

The SEV-ES and TDX changes are compile-tested only.

Sean Christopherson (14):
KVM: x86: Use scratch field in MMIO fragment to hold small write
values
KVM: x86: Open code handling of completed MMIO reads in
emulator_read_write()
KVM: x86: Trace unsatisfied MMIO reads on a per-page basis
KVM: x86: Use local MMIO fragment variable to clean up
emulator_read_write()
KVM: x86: Open code read vs. write userspace MMIO exits in
emulator_read_write()
KVM: x86: Move MMIO write tracing into vcpu_mmio_write()
KVM: x86: Harden SEV-ES MMIO against on-stack use-after-free
KVM: x86: Dedup kvm_sev_es_mmio_{read,write}()
KVM: x86: Consolidate SEV-ES MMIO emulation into a single public API
KVM: x86: Bury emulator read/write ops in
emulator_{read,write}_emulated()
KVM: x86: Fold emulator_write_phys() into write_emulate()
KVM: x86: Rename .read_write_emulate() to .read_write_guest()
KVM: x86: Don't panic the kernel if completing userspace I/O / MMIO
goes sideways
KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exit

 arch/x86/include/asm/kvm_host.h |   3 -
 arch/x86/kvm/emulate.c          |  13 ++
 arch/x86/kvm/svm/sev.c          |  20 +--
 arch/x86/kvm/vmx/tdx.c          |  14 +-
 arch/x86/kvm/x86.c              | 287 ++++++++++++++------------------
 arch/x86/kvm/x86.h              |  30 +++-
 include/linux/kvm_host.h        |   3 +-
 7 files changed, 178 insertions(+), 192 deletions(-)

base-commit: 183bb0ce8c77b0fd1fb25874112bc8751a461e49

Signature · 1 line
2.53.0.414.gf7e9f6c205-goog