From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796416052; b=1XjhGv+s5xIm3kbUE/u5qqpqx08hj2MX5WzrRfTXnRAD2WIdeOUt85c/LbZFuILsDQLs xT6NFSksszxbUyodhkcelI1WfPRHN9DMAo/WX1fJJL7HcdXrGcj17ASFG7LQ21EIJDnLN 3nkm4TNMXCS8FwnhbXrtMWszhcoBEmW4b2UBdjuJsZ1xnxAzlmjDHWbWveX9WBWfiNyMw tJxz73SsyNi/P878Xh6LUKcXQthu2x3sXT9BQhqDxd86FEkgwgPwlqDbQYxTWuWZYa3LN bC/I3hXnh6ldL/iWRt4ZH84niGzXjhLbCEU2n4HA/GuwdVr4P8xIQbV3B48EQ8iCj/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796416052; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=eMc/hVD9tx+d25EDE0JonnxC/C7yJF/09o/S99p0riw=; b=MJzkUJ27khCisZHrBOVJpEcycuw3W15Cw9sU67YxQ8BWuWQcA1Xvh6YVjkAJ3Dy0yMKS jAshf1kpCveuhjAAUT7rNUpdfiUs8ClhxCUJXR8NFnOA8zQ5MaGRf0A80NGwrVWN6CRdj zbR1euxmcX02oElI/OxUdk5DFpmUzlCSCGz4/MA+foE21gdCrNJKQNG2KJVQY7uCgd9U/ W9+QxQO0GFwVBha+pgPYzzGfJnxn6gcrVfKElSmJtt/Q3S0u8rVVG/q0ErwGhMQc+eTFp 3BYIFzvP+5oiBPHf1GeSyMJnco2C9/qx5NOGDluKDymD+xznSNTPraE4EfqKcBttpgg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MKlm9Rwu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 186F0606A322 for ; Fri, 4 Dec 2026 20:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MKlm9Rwu Received: by smtp.kernel.org (Postfix) with ESMTPSA id D145B1F00A06; Fri, 4 Dec 2026 20:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796416051; bh=eMc/hVD9tx+d25EDE0JonnxC/C7yJF/09o/S99p0riw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=MKlm9RwufoOehZ8XNiCE8mhGUYkrmW7E0FaqP/q1CINiDLSGYMgrtpu+IznYZ20g8 ogvzb6o5v+UTCDVTYuvHN+G2d98ONrN8WdcF14ik35wif0S2cbvMVF00mRjrQQMqH0 FeNZK7RuUytGeNPrb+aFTs9m/2aYe953adJUFNWOgca6ZQq/J/ALxjBFpULGAv2jlJ jKvRUSY7l8mrainR2RHAfETnER5Jj3Yyt6trq2ZdNdOckowf1eWuMN8KqtHa5gG2xK HW/Rv1sYdE1zhO8luTb5uRk/MzuCpzy1FXXbHipsarTqVkDJ5B/w97ui6J+DoPPHhq vl/QABfPcuJmw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ Reply-To: sashiko-reviews@lists.linux.dev To: "Paolo Bonzini" , kvm@vger.kernel.org In-Reply-To: <20261204175930.2154542-18-pbonzini@redhat.com> References: <20261204175930.2154542-1-pbonzini@redhat.com> <20261204175930.2154542-18-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 20:27:31 +0000 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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_v= p() 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 !=3D -1 without READ_ONCE(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204175930.2154= 542-1-pbonzini@redhat.com?part=3D17