Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "dmaluka@chromium.org" <dmaluka@chromium.org>,
	"seanjc@google.com" <seanjc@google.com>
Cc: "Gao, Chao" <chao.gao@intel.com>,
	"aashish@aashishsharma.net" <aashish@aashishsharma.net>,
	"jaszczyk@chromium.org" <jaszczyk@chromium.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"vineeth@bitbyteword.org" <vineeth@bitbyteword.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"naveen@kernel.org" <naveen@kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"Dong, Chuanxiao" <chuanxiao.dong@intel.com>
Subject: Re: [PATCH v2 2/2] KVM: VMX: Fix stale PID-pointer table entry left after vCPU free
Date: Thu, 30 Jul 2026 00:28:08 +0000	[thread overview]
Message-ID: <8a663f6e9078a1f6087f9fc03c0528a42c969671.camel@intel.com> (raw)
In-Reply-To: <20260729170621.308809-3-dmaluka@chromium.org>

On Wed, 2026-07-29 at 17:06 +0000, Dmytro Maluka wrote:
> vCPU creation in kvm_vm_ioctl_create_vcpu() may fail after
> kvm_arch_vcpu_create() -> vmx_vcpu_create() already succeeded. In such
> case kvm_vm_ioctl_create_vcpu() destroys the newly created vCPU in the
> failure path. However, that leaves a side effect: the IPIv pid_table
> entry remains configured with this vCPU's pi_desc address. As a result,
> when another vCPU sends an IPI to the APIC ID of this failed-to-create
> vCPU, it will cause HW to write to this (freed!) pi_desc memory. [*]
> 
> Fix this by clearing the pid_table entry when destroying the vCPU.
> 
> Note that the same issue exists for SVM AVIC as well [1], to be fixed.
> 
> [*] Although, since this memory is freed into the kvm_vcpu_cache kmem
>     cache which is only used for allocating kvm_vcpus, _maybe_ this
>     memory will only be reused for pi_desc of another vCPU, not for
>     anything else. So _maybe_ this will only result in delivering the
>     IPI to a wrong vCPU (possibly of another VM) in the worst case, not
>     in a random corruption of kernel memory.
> 
> [1] https://lore.kernel.org/kvm/al4rNqpBYy8FGKPw@blrnaveerao1/
> 
> Signed-off-by: Dmytro Maluka <dmaluka@chromium.org>

Reviewed-by: Kai Huang <kai.huang@intel.com>

  parent reply	other threads:[~2026-07-30  0:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 17:06 [PATCH v2 0/2] KVM: VMX: Fix IPIv use-after-free + improve checking duplicate vcpu_id Dmytro Maluka
2026-07-29 17:06 ` [PATCH v2 1/2] KVM: Check for duplicate vcpu_id as early as possible Dmytro Maluka
2026-07-30  0:23   ` Huang, Kai
2026-07-29 17:06 ` [PATCH v2 2/2] KVM: VMX: Fix stale PID-pointer table entry left after vCPU free Dmytro Maluka
2026-07-29 17:28   ` sashiko-bot
2026-07-29 18:06     ` Dmytro Maluka
2026-07-29 23:57       ` Sean Christopherson
2026-07-30  0:28   ` Huang, Kai [this message]
2026-08-05 16:46 ` [PATCH v2 0/2] KVM: VMX: Fix IPIv use-after-free + improve checking duplicate vcpu_id Sean Christopherson

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=8a663f6e9078a1f6087f9fc03c0528a42c969671.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=aashish@aashishsharma.net \
    --cc=chao.gao@intel.com \
    --cc=chuanxiao.dong@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dmaluka@chromium.org \
    --cc=jaszczyk@chromium.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vineeth@bitbyteword.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox