linux/Documentation/virt
Thomas Prescher 85542adb65 KVM: x86: Add KVM_RUN_X86_GUEST_MODE kvm_run flag
When a vCPU is interrupted by a signal while running a nested guest,
KVM will exit to userspace with L2 state. However, userspace has no
way to know whether it sees L1 or L2 state (besides calling
KVM_GET_STATS_FD, which does not have a stable ABI).

This causes multiple problems:

The simplest one is L2 state corruption when userspace marks the sregs
as dirty. See this mailing list thread [1] for a complete discussion.

Another problem is that if userspace decides to continue by emulating
instructions, it will unknowingly emulate with L2 state as if L1
doesn't exist, which can be considered a weird guest escape.

Introduce a new flag, KVM_RUN_X86_GUEST_MODE, in the kvm_run data
structure, which is set when the vCPU exited while running a nested
guest.  Also introduce a new capability, KVM_CAP_X86_GUEST_MODE, to
advertise the functionality to userspace.

[1] https://lore.kernel.org/kvm/20240416123558.212040-1-julian.stecklina@cyberus-technology.de/T/#m280aadcb2e10ae02c191a7dc4ed4b711a74b1f55

Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
Link: https://lore.kernel.org/r/20240508132502.184428-1-julian.stecklina@cyberus-technology.de
Signed-off-by: Sean Christopherson <seanjc@google.com>
2024-06-11 09:24:31 -07:00
..
acrn docs: acrn: Introduce ACRN 2021-02-09 10:58:18 +01:00
coco Documentation: virt: Fix up pre-formatted text block for SEV ioctls 2024-02-02 17:21:22 +01:00
hyperv Documentation: hyperv: Add overview of PCI pass-thru device support 2024-03-01 08:29:49 +00:00
kvm KVM: x86: Add KVM_RUN_X86_GUEST_MODE kvm_run flag 2024-06-11 09:24:31 -07:00
uml Documentation: Fix typos 2023-08-18 11:29:03 -06:00
guest-halt-polling.rst Documentation: virt: correct location of haltpoll module params 2023-06-16 08:17:21 -06:00
index.rst Docs/subsystem-apis: Remove '[The ]Linux' prefixes from titles of listed documents 2023-01-24 15:27:08 -07:00
ne_overview.rst nitro_enclaves: Update documentation for Arm64 support 2021-09-14 11:11:20 +02:00
paravirt_ops.rst Documentation: virt: Clean up paravirt_ops doc 2023-06-19 12:09:54 +02:00