mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+82112403ace4cbd780d8@syzkaller.appspotmail.com
Subject: [PATCH 0/2] KVM: VMX: Fix and test for emulation + exception
Date: Tue, 28 Dec 2021 23:24:35 +0000	[thread overview]
Message-ID: <20211228232437.1875318-1-seanjc@google.com> (raw)

Fix an issue that allows userspace to trigger a WARN by rejecting KVM_RUN
if userspace attempts to run a vCPU that require emulation in KVM and has
a pending exception, which is not supported in KVM.

No small part of me thinks this is a waste of code and that we'd be better
off just deleting the WARN.  But it's also not hard to fix and there are
still folks out there that run on Core2...

Intentionally didn't tag for stable.  I highly doubt this actually fixes
anything for anyone, the goal is purely to prevent userspace from triggering
the WARN.

Sean Christopherson (2):
  KVM: VMX: Reject KVM_RUN if emulation is required with pending
    exception
  KVM: selftests: Add a test to force emulation with a pending exception

 arch/x86/include/asm/kvm-x86-ops.h            |   1 +
 arch/x86/include/asm/kvm_host.h               |   1 +
 arch/x86/kvm/svm/svm.c                        |   6 +
 arch/x86/kvm/vmx/vmx.c                        |  22 ++-
 arch/x86/kvm/x86.c                            |  12 +-
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../vmx_exception_with_invalid_guest_state.c  | 139 ++++++++++++++++++
 8 files changed, 178 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/vmx_exception_with_invalid_guest_state.c

-- 
2.34.1.448.ga2b2bfdf31-goog


             reply	other threads:[~2021-12-28 23:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 23:24 Sean Christopherson [this message]
2021-12-28 23:24 ` [PATCH 1/2] KVM: VMX: Reject KVM_RUN if emulation is required with pending exception Sean Christopherson
2021-12-28 23:24 ` [PATCH 2/2] KVM: selftests: Add a test to force emulation with a " Sean Christopherson
2022-01-18  9:25 ` [PATCH 0/2] KVM: VMX: Fix and test for emulation + exception Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211228232437.1875318-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=syzbot+82112403ace4cbd780d8@syzkaller.appspotmail.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®