From nobody Sun Feb 8 16:50:42 2026 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5BBD19D071 for ; Sat, 10 Jan 2026 00:48:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768006126; cv=none; b=BuRypiHTBYNYWAonRUpYMlee/zLaASlAhGAWzFLrWGNUb9lRlCmaq9HEeSG7fj3Ml16KYPxcZAcfTXYNW7hBx5wlYGy6xNs4/NfXzqeBxaoC3NzMfEQulEe6E6de5nv0DQcCPraPJ0d18lEYo+62NpNqKYWyMN28Yzb5SICuI4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768006126; c=relaxed/simple; bh=FJzmaB4ntWmqyKtFbkyHlSUO1/xoZrNN5rnPXBB6b8Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gs9zeAQWvyeav6Pqf6LxbsW2ouenDP5AtHUMFKFMEV5zu5N9t9hUoRjMRbIQY5eaYivYj+mwgAVn29snEc6lfrPNUQQ2g06QVckwAsFDqtdwRPYwpEF1JhwT9hzgcw7+uG+1zFSUAnhHLMw+oz4wnAGFx+v0jX0hcA7kNRcKtiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MZOA4y8r; arc=none smtp.client-ip=95.215.58.171 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) header.d=linux.dev header.i=@linux.dev header.b="MZOA4y8r" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768006123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gDgt+ECmMkXAmQuSwl6mDbmVPT38/lyN/PXVzf05jSg=; b=MZOA4y8rzWIm/x4hJwN8QkGQFBzJWzpmB3XbH7BBWwXNvj/+1RgbmfuZcp96Rc92z96MIP z9jlw8fpN9mtUwN2IpaYfrcqAXwlLfH75WUuBJbmMfp90CHPiochSEjJooz+u02fYV/Hfu qywhLPccjla3PgYVS+fTTEo00R9p1xI= From: Yosry Ahmed To: Sean Christopherson Cc: Paolo Bonzini , Jim Mattson , Kevin Cheng , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed , Maxim Levitsky , stable@vger.kernel.org Subject: [PATCH 1/4] KVM: nSVM: Always use vmcb01 in VMLOAD/VMSAVE emulation Date: Sat, 10 Jan 2026 00:48:18 +0000 Message-ID: <20260110004821.3411245-2-yosry.ahmed@linux.dev> In-Reply-To: <20260110004821.3411245-1-yosry.ahmed@linux.dev> References: <20260110004821.3411245-1-yosry.ahmed@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Commit cc3ed80ae69f ("KVM: nSVM: always use vmcb01 to for vmsave/vmload of guest state") made KVM always use vmcb01 for the fields controlled by VMSAVE/VMLOAD, but it missed updating the VMLOAD/VMSAVE emulation code to always use vmcb01. As a result, if VMSAVE/VMLOAD is executed by an L2 guest and is not intercepted by L1, KVM will mistakenly use vmcb02. Always use vmcb01 instead of the current VMCB. Fixes: cc3ed80ae69f ("KVM: nSVM: always use vmcb01 to for vmsave/vmload of = guest state") Cc: Maxim Levitsky Cc: stable@vger.kernel.org Signed-off-by: Yosry Ahmed --- arch/x86/kvm/svm/svm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 7041498a8091..4e4439a01828 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2165,12 +2165,13 @@ static int vmload_vmsave_interception(struct kvm_vc= pu *vcpu, bool vmload) =20 ret =3D kvm_skip_emulated_instruction(vcpu); =20 + /* KVM always performs VMLOAD/VMSAVE on VMCB01 (see __svm_vcpu_run()) */ if (vmload) { - svm_copy_vmloadsave_state(svm->vmcb, vmcb12); + svm_copy_vmloadsave_state(svm->vmcb01.ptr, vmcb12); svm->sysenter_eip_hi =3D 0; svm->sysenter_esp_hi =3D 0; } else { - svm_copy_vmloadsave_state(vmcb12, svm->vmcb); + svm_copy_vmloadsave_state(vmcb12, svm->vmcb01.ptr); } =20 kvm_vcpu_unmap(vcpu, &map); --=20 2.52.0.457.g6b5491de43-goog