From: sashiko-bot@kernel.org
To: "Paolo Bonzini" <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ
Date: Fri, 04 Dec 2026 20:27:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-250621@kernel.org> (raw)
In-Reply-To: <20261204175930.2154542-18-pbonzini@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: VMX: inaccurate commit notes and missed READ_ONCE() on
vcpu->cpu
--
commit d094dd6a1e80f9a875e1dd76aa9eecef276dd0aa
Author: Sean Christopherson <seanjc@google.com>
KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ
This commit validates vcpu->cpu before sending a posted-interrupt IPI in
kvm_vcpu_trigger_posted_interrupt() and adds READ_ONCE()/WRITE_ONCE()
annotations to vcpu->cpu accesses in tdx.c and kvm_arch_vcpu_load().
Link: https://patch.msgid.link/20261119173451.67434-1-seanjc@google.com
> Note #4, tdx_vcpu_free() checks vcpu->cpu without using READ_ONCE(), but
> that's a-ok since the vCPU is unreachable, i.e. vcpu->cpu can't change.
[ ... ]
> Note #7, the only reason reading vcpu->cpu multiple times when loading a
> vCPU isn't completely broken is because loading a vCPU is mutually
> exclusive with disassociating a vCPU from a pCPU, outside of the
> aforementioned self-induced pain with .vcpu_load(), thanks to commit
> 15945e9ec195 ("KVM: TDX: Guard VM state transitions with "all" the locks").
[Severity: Low]
Can CPU hot-unplug still disassociate a TDX vCPU concurrently with
tdx_vcpu_load() and tdx_vcpu_free(), making Notes #4 and #7 inaccurate and
leaving KCSAN data races on vcpu->cpu?
Commit 15945e9ec195 ("KVM: TDX: Guard VM state transitions with "all" the
locks") serializes TD state-transition ioctls, not CPU offlining. During
CPUHP_AP_KVM_ONLINE, tdx_disable_virtualization_cpu() -> tdx_disassociate_vp()
writes WRITE_ONCE(vcpu->cpu, -1) without vcpu->mutex or kvm->lock.
Meanwhile, another CPU can run vcpu_load() -> kvm_arch_vcpu_load() ->
tdx_vcpu_load() without cpus_read_lock() (as noted in tdx_flush_vp()) and
read vcpu->cpu without READ_ONCE().
Similarly, on the KVM_CREATE_VCPU error path after kvm_arch_vcpu_create(),
the vCPU is still linked on per-CPU associated_tdvcpus. CPU hot-unplug can
reach it via tdx_disable_virtualization_cpu() while tdx_vcpu_free() checks
vcpu->cpu != -1 without READ_ONCE().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204175930.2154542-1-pbonzini@redhat.com?part=17
prev parent reply other threads:[~2026-12-04 20:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 17:59 [PATCH 00/17] Fixes for various (mostly x86) KVM vulnerabilities Paolo Bonzini
2026-12-04 17:59 ` [PATCH 01/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE Paolo Bonzini
2026-12-04 17:59 ` [PATCH 02/17] KVM: x86/mmu: Propagate the return from kvm_zap_all_rmap_sptes() out of __rmap_add() Paolo Bonzini
2026-12-04 17:59 ` [PATCH 03/17] KVM: x86: Disable hypervisor (VMX Preemption) timer if TSC deadline wraps Paolo Bonzini
2026-12-04 17:59 ` [PATCH 04/17] KVM: x86: Reset local APIC timer metadata on RESET, INIT, and KVM_SET_LAPIC Paolo Bonzini
2026-12-04 17:59 ` [PATCH 05/17] RISC-V: KVM: Flush TLBs *before* dropping mmu_lock, e.g. when yielding Paolo Bonzini
2026-12-04 19:07 ` sashiko-bot
2026-12-04 17:59 ` [PATCH 06/17] LoongArch: KVM: Flush TLBs *before* dropping mmu_lock Paolo Bonzini
2026-12-04 17:59 ` [PATCH 07/17] KVM: x86/mmu: Flush all TLB entries, not a precise range, when yielding Paolo Bonzini
2026-12-04 17:59 ` [PATCH 08/17] KVM: x86/mmu: Flush TLBs in kvm_unmap_gfn_range() if the unmap may block/yield Paolo Bonzini
2026-12-04 17:59 ` [PATCH 09/17] KVM: x86/xen: Pin kvm->mm prior to borrowing mm when setting event channel Paolo Bonzini
2026-12-04 17:59 ` [PATCH 10/17] KVM: Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release() Paolo Bonzini
2026-12-04 17:59 ` [PATCH 11/17] KVM: WARN if there are in-flight memslot updates when a VM's process exits Paolo Bonzini
2026-12-04 17:59 ` [PATCH 12/17] KVM: Set mn_active_invalidate_count when the VM's mm is released Paolo Bonzini
2026-12-04 17:59 ` [PATCH 13/17] KVM: Invalidate all GFN=>PFN caches when VM and/or its process is dying Paolo Bonzini
2026-12-04 20:01 ` sashiko-bot
2026-12-04 17:59 ` [PATCH 14/17] x86/fpu: Bail early from guest XFD update if XFD isn't supported Paolo Bonzini
2026-12-04 17:59 ` [PATCH 15/17] x86/fpu: Clear XSTATE_BV[i] in guest XSAVE state if guest FPU isn't in-use Paolo Bonzini
2026-12-04 17:59 ` [PATCH 16/17] x86/fpu: Ensure guest FPU is resident in hardware when updating actual XFD MSR Paolo Bonzini
2026-12-04 20:11 ` sashiko-bot
2026-12-04 17:59 ` [PATCH 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ Paolo Bonzini
2026-12-04 20:27 ` sashiko-bot [this message]
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=sashiko-outbox-250621@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
/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