From: Chenyi Qiang <chenyi.qiang@intel.com>
To: Peter Xu <peterx@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Eduardo Habkost <eduardo@habkost.net>,
Xiaoyao Li <xiaoyao.li@intel.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [PATCH v5 3/3] i386: Add notify VM exit support
Date: Tue, 13 Sep 2022 09:13:57 +0800 [thread overview]
Message-ID: <db7834a7-5006-4345-3c66-2277c68d29e3@intel.com> (raw)
In-Reply-To: <YxtpBMZmrDK3cghT@xz-m1.local>
On 9/10/2022 12:25 AM, Peter Xu wrote:
> On Wed, Aug 17, 2022 at 10:08:45AM +0800, Chenyi Qiang wrote:
>> There are cases that malicious virtual machine can cause CPU stuck (due
>> to event windows don't open up), e.g., infinite loop in microcode when
>> nested #AC (CVE-2015-5307). No event window means no event (NMI, SMI and
>> IRQ) can be delivered. It leads the CPU to be unavailable to host or
>> other VMs. Notify VM exit is introduced to mitigate such kind of
>> attacks, which will generate a VM exit if no event window occurs in VM
>> non-root mode for a specified amount of time (notify window).
>>
>> A new KVM capability KVM_CAP_X86_NOTIFY_VMEXIT is exposed to user space
>> so that the user can query the capability and set the expected notify
>> window when creating VMs. The format of the argument when enabling this
>> capability is as follows:
>> Bit 63:32 - notify window specified in qemu command
>> Bit 31:0 - some flags (e.g. KVM_X86_NOTIFY_VMEXIT_ENABLED is set to
>> enable the feature.)
>>
>> Because there are some concerns, e.g. a notify VM exit may happen with
>> VM_CONTEXT_INVALID set in exit qualification (no cases are anticipated
>> that would set this bit), which means VM context is corrupted. To avoid
>> the false positive and a well-behaved guest gets killed, make this
>> feature disabled by default. Users can enable the feature by a new
>> machine property:
>> qemu -machine notify_vmexit=on,notify_window=0 ...
>
> The patch looks sane to me; I only read the KVM interface, though. Worth
> add a section to qemu-options.hx? It'll also be worthwhile to mention the
> valid range of notify_window and meaning of zero (IIUC that's also a valid
> input, just use the hardware default window size).
>
Thanks Peter for your review.
I'll add some doc in qemu-option.hx and also the commit message about
the valid range in next version.
> Thanks,
>
>>
>> A new KVM exit reason KVM_EXIT_NOTIFY is defined for notify VM exit. If
>> it happens with VM_INVALID_CONTEXT, hypervisor exits to user space to
>> inform the fatal case. Then user space can inject a SHUTDOWN event to
>> the target vcpu. This is implemented by injecting a sythesized triple
>> fault event.
>
prev parent reply other threads:[~2022-09-13 1:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 2:08 [PATCH v5 0/3] Enable notify VM exit Chenyi Qiang
2022-08-17 2:08 ` [PATCH v5 1/3] Update linux headers to 6.0-rc1 Chenyi Qiang
2022-08-22 15:00 ` Michal Prívozník
2022-08-23 10:09 ` Chenyi Qiang
2022-08-23 14:44 ` Daniel P. Berrangé
2022-08-17 2:08 ` [PATCH v5 2/3] i386: kvm: extend kvm_{get, put}_vcpu_events to support pending triple fault Chenyi Qiang
2022-09-09 16:11 ` Peter Xu
2022-08-17 2:08 ` [PATCH v5 3/3] i386: Add notify VM exit support Chenyi Qiang
2022-09-05 1:05 ` Chenyi Qiang
2022-09-09 16:25 ` Peter Xu
2022-09-13 1:13 ` Chenyi Qiang [this message]
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=db7834a7-5006-4345-3c66-2277c68d29e3@intel.com \
--to=chenyi.qiang@intel.com \
--cc=eduardo@habkost.net \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=xiaoyao.li@intel.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;
as well as URLs for NNTP newsgroup(s).