qemu-e2k/qapi
Chenyi Qiang e2e69f6bb9 i386: add notify VM exit support
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.)

Users can configure the feature by a new (x86 only) accel property:
    qemu -accel kvm,notify-vmexit=run|internal-error|disable,notify-window=n

The default option of notify-vmexit is run, which will enable the
capability and do nothing if the exit happens. The internal-error option
raises a KVM internal error if it happens. The disable option does not
enable the capability. The default value of notify-window is 0. It is valid
only when notify-vmexit is not disabled. The valid range of notify-window
is non-negative. It is even safe to set it to zero since there's an
internal hardware threshold to be added to ensure no false positive.

Because 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. It would be reflected in the flags of
KVM_EXIT_NOTIFY exit. If KVM_NOTIFY_CONTEXT_INVALID bit is set, raise a KVM
internal error unconditionally.

Acked-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Message-Id: <20220929072014.20705-5-chenyi.qiang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-10-11 09:36:00 +02:00
..
acpi.json qapi: fix example of ACPI_DEVICE_OST event 2022-03-31 12:35:59 +02:00
audio.json audio: Add sndio backend 2022-09-27 07:32:31 +02:00
authz.json
block-core.json qapi: fix examples of blockdev-add with qcow2 2022-09-07 15:10:13 +02:00
block-export.json vduse-blk: Add name option 2022-06-24 17:07:06 +02:00
block.json block: add more commands to preconfig mode 2022-06-14 16:50:30 +02:00
char.json qapi: Stop using whitespace for alignment in comments 2022-05-16 07:26:25 +02:00
common.json qapi: Drop unnecessary empty lines in comments 2022-05-16 07:22:28 +02:00
compat.json qapi: Belatedly adjust limitations documentation 2022-02-28 11:39:35 +01:00
control.json qapi: Stop using whitespace for alignment in comments 2022-05-16 07:26:25 +02:00
crypto.json qapi: crypto-akcipher: Introduce akcipher types to qapi 2022-05-26 11:41:42 +01:00
dump.json qapi: fix example of query-dump-guest-memory-capability command 2022-09-07 15:10:13 +02:00
error.json
introspect.json
job.json qapi: Drop unnecessary empty lines outside of comments 2022-05-16 07:22:28 +02:00
machine-target.json target/loongarch: Implement qmp_query_cpu_definitions() 2022-06-06 18:09:03 +00:00
machine.json qapi: fix example of query-hotpluggable-cpus command 2022-09-07 15:10:13 +02:00
meson.build meson: remove dead code 2022-09-01 07:42:37 +02:00
migration.json qapi: fix examples of events missing timestamp 2022-09-07 15:10:13 +02:00
misc-target.json qapi: Drop unnecessary whitespace in comments 2022-05-16 07:22:28 +02:00
misc.json vfio-user: run vfio-user context 2022-06-15 16:43:42 +01:00
net.json qapi: fix example of NIC_RX_FILTER_CHANGED event 2022-09-07 15:10:13 +02:00
opts-visitor.c
pci.json
pragma.json qapi/pragma: Tidy up comments 2022-05-16 07:31:26 +02:00
qapi-clone-visitor.c
qapi-dealloc-visitor.c
qapi-forward-visitor.c qapi: remove needless include 2022-03-22 14:46:18 +04:00
qapi-schema.json qmp: Support for querying stats 2022-06-14 16:50:29 +02:00
qapi-type-helpers.c
qapi-util.c qapi: Fix stale reference to scripts/qapi.py in a comment 2022-02-28 11:39:35 +01:00
qapi-visit-core.c
qdev.json qapi: fix example of DEVICE_UNPLUG_GUEST_ERROR event 2022-09-07 15:10:13 +02:00
qmp-dispatch.c qapi: remove needless include 2022-03-22 14:46:17 +04:00
qmp-event.c Replace qemu_gettimeofday() with g_get_real_time() 2022-04-06 10:50:37 +02:00
qmp-registry.c
qobject-input-visitor.c include: add qemu/keyval.h 2022-04-21 17:03:51 +04:00
qobject-output-visitor.c
qom.json vfio-user: define vfio-user-server object 2022-06-15 16:43:42 +01:00
rdma.json
replay.json qapi: Drop unnecessary empty lines in comments 2022-05-16 07:22:28 +02:00
rocker.json
run-state.json i386: add notify VM exit support 2022-10-11 09:36:00 +02:00
sockets.json qapi: Stop using whitespace for alignment in comments 2022-05-16 07:26:25 +02:00
stats.json monitor: add support for boolean statistics 2022-07-18 18:51:17 +02:00
string-input-visitor.c
string-output-visitor.c qapi: remove needless include 2022-03-22 14:46:18 +04:00
tpm.json
trace-events
trace.h
trace.json qapi: fix example of trace-event-get-state command 2022-04-05 12:30:45 +02:00
transaction.json qapi: deprecate drive-backup 2021-11-09 18:21:19 +01:00
ui.json qapi: fix example of query-vnc command 2022-09-07 15:10:13 +02:00
yank.json