Skip to content

KVM: x86: Syzkaller nested_run_pending defense

Sean Christopherson kvm lkml 2 versions – Applied

Status from this message: Applied to kvm-x86 nested.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied
  2. v12 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Put the state transition in kvm_x86_vcpu_pre_run(). [Yosry]
- Add Yosry's review.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: x86: Move nested_run_pending to kvm_vcpu_archarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +4 more+57 -550 replies
2/2KVM: x86: Suppress WARNs on nested_run_pending after userspace exitarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +4 more+40 -120 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchYosry Ahmed
1/2
2/2R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: x86: Syzkaller nested_run_pending defense

Stop playing a losing game of whack-a-mole with syzkaller over nested_run_pending, and simply treat the flag as "untrusted" if userspace gains control of the vCPU. I.e. don't WARN if userspace _may_ have stuffed vCPU state to force an impossible VM-Exit.

The signal:noise ratio for nested_run_pending WARNs when syzkaller is fuzzing nVMX/nSVM is awful, and playing whack-a-mole with syzkaller is doing more harm that good at this point. While it's possible syzkaller could find an actual KVM bug by stuffing vCPU state, if the _only_ symptom is the nested_run_pending WARN, then in theory the bug should also be hittable by stuffing L2 state prior to nested VM-Enter.

v2:
- Put the state transition in kvm_x86_vcpu_pre_run(). [Yosry]
- Add Yosry's review.

v1: https://lore.kernel.org/all/[email protected]

Sean Christopherson (1):
KVM: x86: Suppress WARNs on nested_run_pending after userspace exit

Yosry Ahmed (1):
KVM: x86: Move nested_run_pending to kvm_vcpu_arch

 arch/x86/include/asm/kvm_host.h | 15 ++++++++++
 arch/x86/kvm/svm/nested.c       | 23 ++++++++-------
 arch/x86/kvm/svm/svm.c          | 16 +++++------
 arch/x86/kvm/svm/svm.h          |  4 ---
 arch/x86/kvm/vmx/nested.c       | 50 +++++++++++++++++----------------
 arch/x86/kvm/vmx/vmx.c          | 16 +++++------
 arch/x86/kvm/vmx/vmx.h          |  3 --
 arch/x86/kvm/x86.c              |  7 +++++
 arch/x86/kvm/x86.h              | 10 +++++++
 9 files changed, 87 insertions(+), 57 deletions(-)

base-commit: bfd7f4adc1230373c25e1b787a6f1ee407eb0656

Signature · 1 line
2.53.0.851.ga537e3e6e9-goog