From: Fuad Tabba <fuad.tabba@linux.dev>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Isaku Yamahata <isaku.yamahata@intel.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Lorenzo Stoakes <ljs@kernel.org>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
kvmarm@lists.linux.dev, Wei-Lin Chang <weilin.chang@arm.com>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atish.patra@linux.dev>,
kvm-riscv@lists.infradead.org, Will Deacon <will@kernel.org>,
Fuad Tabba <tabba@google.com>
Subject: [PATCH v3 2/3] KVM: Warn userspace against ioctls while an exit is pending
Date: Mon, 23 Nov 2026 11:34:34 +0000 [thread overview]
Message-ID: <20261123113435.1170711-3-fuad.tabba@linux.dev> (raw)
In-Reply-To: <20261123113435.1170711-1-fuad.tabba@linux.dev>
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@google.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
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
WARNING: multiple messages have this Message-ID (diff)
From: Fuad Tabba <fuad.tabba@linux.dev>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Isaku Yamahata <isaku.yamahata@intel.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Lorenzo Stoakes <ljs@kernel.org>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
kvmarm@lists.linux.dev, Wei-Lin Chang <weilin.chang@arm.com>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atish.patra@linux.dev>,
kvm-riscv@lists.infradead.org, Will Deacon <will@kernel.org>,
Fuad Tabba <tabba@google.com>
Subject: [PATCH v3 2/3] KVM: Warn userspace against ioctls while an exit is pending
Date: Mon, 23 Nov 2026 11:34:34 +0000 [thread overview]
Message-ID: <20261123113435.1170711-3-fuad.tabba@linux.dev> (raw)
In-Reply-To: <20261123113435.1170711-1-fuad.tabba@linux.dev>
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@google.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
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
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2026-11-23 11:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 11:34 [PATCH v3 0/3] KVM: Bound KVM_PRE_FAULT_MEMORY by the vCPU's dirty ring Fuad Tabba
2026-11-23 11:34 ` Fuad Tabba
2026-11-23 11:34 ` [PATCH v3 1/3] KVM: Stop KVM_PRE_FAULT_MEMORY when the vCPU's dirty ring is full Fuad Tabba
2026-11-23 11:34 ` Fuad Tabba
2026-11-23 15:27 ` Lorenzo Stoakes (ARM)
2026-11-23 15:27 ` Lorenzo Stoakes (ARM)
2026-11-23 11:34 ` Fuad Tabba [this message]
2026-11-23 11:34 ` [PATCH v3 2/3] KVM: Warn userspace against ioctls while an exit is pending Fuad Tabba
2026-11-23 15:09 ` Lorenzo Stoakes (ARM)
2026-11-23 15:09 ` Lorenzo Stoakes (ARM)
2026-11-23 15:23 ` Fuad Tabba
2026-11-23 15:23 ` Fuad Tabba
2026-11-23 15:31 ` Lorenzo Stoakes (ARM)
2026-11-23 15:31 ` Lorenzo Stoakes (ARM)
2026-11-23 11:34 ` [PATCH v3 3/3] KVM: selftests: Test KVM_PRE_FAULT_MEMORY against a full dirty ring Fuad Tabba
2026-11-23 11:34 ` Fuad Tabba
2026-11-23 14:23 ` [PATCH v3 0/3] KVM: Bound KVM_PRE_FAULT_MEMORY by the vCPU's " Marc Zyngier
2026-11-23 14:23 ` Marc Zyngier
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=20261123113435.1170711-3-fuad.tabba@linux.dev \
--to=fuad.tabba@linux.dev \
--cc=alexandru.elisei@arm.com \
--cc=anup@brainfault.org \
--cc=atish.patra@linux.dev \
--cc=corbet@lwn.net \
--cc=isaku.yamahata@intel.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=skhan@linuxfoundation.org \
--cc=tabba@google.com \
--cc=weilin.chang@arm.com \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.