From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.221 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795433686; b=MKf/+cS9xLby0eZsmUjaGWDSHMhU22n1d72S2gar0cLbyb0N5T6w8UQUg6se7yT4sBOl fhpQg/uKIPyNG14yBPVcQxr2/FD2T5MGBw1YH4RAN8/ieX0sURJCBGZy/bQu+Y4ls9sIz rYE5McM118yjlvBQFL55urPPJuai02NtY8Dwvk+K81h0a0OIGfOvB9iyKy4BoZkLQJtfJ fi56Btb8dNZwA3ns0tYnSNaKj/ojTQMkl0pAHsq9n+cYmElGxSIqgGxDIkaQlwsA7oU50 OprnmwHxNV5NnrmYNdIkmlcMwOVxIBaNzNFgKyYO/MbjX4w4jK5WDOX4VRxI5MjtAaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795433686; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=UppeewSJQTI9wML/iAiukB2NfsE5bh7Xk8VoIJRzzKE=; b=2gABqiDD3ATbviOM2JmJmoe+wXDezp9+vFjoTa/MAu1hPIDofrZ5xuKR+cZOqv1D2IIO dWs1+Oy01Ok8JNffdXo+jccZ3xosSFMlljEpzMNGNsmnwbGNoCNU4kpX5pAeGVXdSpj0M DszFSy2KSAmvKclIUrjAlppL5oB5cE/NGTBQXISBMgn9BLt9mrRb1q9BxFqp6y5zU6Wxo aDPm+mkTYuONTD50BB8Sj/nBcxqgAOVdQC62TU4x8KMxxcmoR830+dXRruR1h6iQs+A9A mRHuPuWweb6etB4IUH0ZpRTN/Qsdyhqx6k/iNUCiK5daRggtErYwpEL6TgUC/a3SodQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=G0TQwbQf; arc=none smtp.remote-ip=95.215.58.221 Received: from mta1.migadu.com (out-221.mta1.migadu.com [95.215.58.221]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53610606A698 for ; Mon, 23 Nov 2026 11:34:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 53610606A698 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=G0TQwbQf X-Envelope-To: linux-kselftest@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=kJVYvwnmwcWNzEw2JdWH14aPDZC8p2gGMQyighOKNqY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795433683; v=1; x=1796038483; b=G0TQwbQf7Kj4y/R6ox6nny9M8jPCzE187Ty8ReY69/nju2wzoC+y5I9ya0vYj9QW/3FWlWyH G25nR7EQEz3etHUljY+sBKLfq+jmR6sCb2TE89hKrsEC2encTA8VdM4IZNCEMihAEQlDswljmJj inhMt+6tpk4fOfwl+SEyyLPs= X-Envelope-To: linux-kselftest@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 9a34595c63725e53; Mon, 23 Nov 2026 11:34:43 +0000 X-Mizu-Trace-ID: 9a34595c63725e53 X-Migadu-Flow: FLOW_OUT From: Fuad Tabba To: Paolo Bonzini , Sean Christopherson Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Jonathan Corbet , Shuah Khan , Isaku Yamahata , Rick Edgecombe , Lorenzo Stoakes , Alexandru Elisei , Marc Zyngier , Oliver Upton , kvmarm@lists.linux.dev, Wei-Lin Chang , Anup Patel , Atish Patra , kvm-riscv@lists.infradead.org, Will Deacon , Fuad Tabba Subject: [PATCH v3 2/3] KVM: Warn userspace against ioctls while an exit is pending Date: Mon, 23 Nov 2026 11:34:34 +0000 Message-ID: <20261123113435.1170711-3-fuad.tabba@linux.dev> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261123113435.1170711-1-fuad.tabba@linux.dev> References: <20261123113435.1170711-1-fuad.tabba@linux.dev> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Fuad Tabba --- 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