[PATCH v3 2/3] KVM: Warn userspace against ioctls while an exit is pending

From: Fuad Tabba

Date: Mon Nov 23 2026 - 06:34:52 EST


KVM_PRE_FAULT_MEMORY sets run->exit_reason to KVM_EXIT_DIRTY_RING_FULL
when it stops on a full dirty ring. If an MMIO exit is pending at that
point, the next KVM_RUN on arm64 and riscv doesn't complete it. Rather
than document that case alone, which could suggest that other ioctls
are safe, warn against invoking any ioctl other than KVM_RUN before a
pending exit is completed.

Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
Documentation/virt/kvm/api.rst | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index 89eb6be9bc6e3..980ef0cdc1c91 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -6974,10 +6974,13 @@ to the byte array.

The pending state of the operation is not preserved in state which is
visible to userspace, thus userspace should ensure that the operation is
- completed before performing a live migration. Userspace can re-enter the
- guest with an unmasked signal pending or with the immediate_exit field set
- to complete pending operations without allowing any further instructions
- to be executed.
+ completed before performing a live migration. In general, userspace should
+ exercise extreme caution when invoking ioctls other than KVM_RUN prior to
+ completing the original operation.
+
+ Userspace can re-enter the guest with an unmasked signal pending or with
+ the immediate_exit field set to complete pending operations without
+ allowing any further instructions to be executed.

::

--
2.47.3