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=1796376127; b=VKsCOm7uclp+hkeMA/G8ABsfn5Qx8qdk5sP7LUiEXM0XfsjJupFikIrbWY5kB7jXjHY2 UI2mP/g3zUkDZgHv3GjmVzwwQOSM2a0CvnF7w3EBl7MgFj4vwU8+5tMetto+HbX4m/Upe aOXgC04lVXt1NaTqZURAVd7kxeqTWLp2xjrNXOHWNvkh5JpnuzyGL/k3lWm0Zko+jgAy2 wqzS1kzTHAyTPInVoZMbOEjLv4lvTXrt1T46ZtNbXaoUISu2WHkA/rQocM1FiEUF0SD5v 4BYIGvuyVziANlyY+o79yORIRGlT/W9q0gqjOGgT4P6nvKtsj8+TeWkkbeROSGne+RA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796376127; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=xWDw8e8f240IsVjXxCrB0auGRdtHUzvgSyLMIalyVHU=; b=z+wwETSpShcQWD5BE4M+cJVryPE6yEvzgd/hsJJCduibELpsdwejFfuIObbsgWimPGtP aVRJnVRs/12yUhk7MT34HRGoy9n2ZMDozp7AlCGhnR7m6StqaPcVi7kNnW4caGPC0cpy9 2mSx+P2nsGaLpuO36/JBko3NB/Sgk9+pzt/weQ+/FZN2+8o1otzFIduDCZ2lmYNT+/3Qy 93PUi+Gt1dZs3geC7aJWp+OXXjL+rotZ2++Ap0GEtTKK90+Av5yhzKIU1SgoGIef6w5Wa 8HFyHc2EmGIS7LX/aJ/iCnzf8vftAXJj+3Zs0W1L7atPRpnvsH3E6EQgTS2VtPExSUQ== 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=fOa3QXer; 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 E6D7C606A322; Fri, 4 Dec 2026 09:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fOa3QXer Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB121F000C2; Fri, 4 Dec 2026 09:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796376126; bh=xWDw8e8f240IsVjXxCrB0auGRdtHUzvgSyLMIalyVHU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=fOa3QXerS3cdVuIdVHpjpHmE7c6/BSYo7NHbtFQJbX2huCu7zA2Xie8wFers2GiX+ iBulPizeNg1yndndOejwiYKxxyMdPIV9eWgi8N0mAC1jg0QS3BjEQFOKEd6u0pEu49 I1J0aUMhCmKW2kdMCwkm6MS5Y+Vw9j1odVNCaHjQ1aokKMhFFtzPppu7OhKQqnajOu HFfT3KZxuw7FqO/ZGOojR7/+RdfwavlL5Xwn6I2XpSLA+Hgro4q7mZlsfgwFi7slBa IxdG2BhDCNOqVhniChv+NUQrBEHMIVvhKflwyUEB30xDbJrPt0NiWf6ll+den+slc3 3jYUqv+yJZ1gw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 8/9] KVM: arm64: nv: Re-inject a stored SError after the exit is handled Reply-To: sashiko-reviews@lists.linux.dev To: "Dan Carpenter" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261204-double_exception_v4-v4-8-523921511673@pereq.eu> References: <20261204-double_exception_v4-v4-0-523921511673@pereq.eu> <20261204-double_exception_v4-v4-8-523921511673@pereq.eu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:22:06 +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: - [Medium] KVM: arm64: premature SError flush on aborted KVM_RUN entry -- commit 7423847623949f2a8f284b19a9a62edd87bac9cd Author: Dan Carpenter KVM: arm64: nv: Re-inject a stored SError after the exit is handled This commit defers re-injecting a stored nested SError from kvm_nested_sync_hwstate() to kvm_nested_flush_hwstate(), committing any pending exit-handler exception or PC increment first via __kvm_adjust_pc(). It also updates kvm_arch_vcpu_runnable() so a deliverable stored SError wak= es the vCPU. > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > index 78d5b18dbd2d6..f063c01c565a0 100644 > --- a/arch/arm64/kvm/nested.c > +++ b/arch/arm64/kvm/nested.c > @@ -2213,8 +2213,11 @@ void kvm_nested_flush_hwstate(struct kvm_vcpu *vcp= u) > if (!vcpu_has_nv(vcpu)) > return; > =20 > - if (unlikely(vcpu_test_and_clear_flag(vcpu, NESTED_SERROR_PENDING))) > + if (unlikely(vcpu_test_and_clear_flag(vcpu, NESTED_SERROR_PENDING))) { > + /* Commit the exit handler's exception first */ > + __kvm_adjust_pc(vcpu); > kvm_inject_serror_esr(vcpu, vcpu_get_vsesr(vcpu)); > + } > =20 > vgic_v3_nested_update_mi(vcpu); [Severity: Medium] Can kvm_nested_flush_hwstate() consume NESTED_SERROR_PENDING and inject the SError even when guest entry is aborted? kvm_arch_vcpu_ioctl_run() calls kvm_nested_flush_hwstate() unconditionally before checking ret <=3D 0 or kvm_vcpu_exit_request(): arch/arm64/kvm/arm.c:kvm_arch_vcpu_ioctl_run() { ... if (ret > 0) ret =3D check_vcpu_requests(vcpu); ... kvm_nested_flush_hwstate(vcpu); local_irq_disable(); ... if (ret <=3D 0 || kvm_vcpu_exit_request(vcpu, &ret)) { ... } If a signal makes kvm_xfer_to_guest_mode_handle_work() return -EINTR on a suspended vCPU with an unmasked or EL2-routed NESTED_SERROR_PENDING, check_vcpu_requests() is skipped, yet kvm_nested_flush_hwstate() still clea= rs NESTED_SERROR_PENDING and injects the SError. The out: path then commits that exception via __kvm_adjust_pc() into the still-suspended vCPU. On the next KVM_RUN, kvm_vcpu_suspend() sees neither HCR_EL2_VSE nor NESTED_SERROR_PENDING set and blocks indefinitely instead of reporting KVM_SYSTEM_EVENT_WAKEUP. Even without a signal, kvm_vcpu_suspend() returns 0 for KVM_SYSTEM_EVENT_WAKEUP while keeping the vCPU suspended, so kvm_nested_flush_hwstate() still consumes NESTED_SERROR_PENDING and mutates the suspended vCPU's registers before returning to userspace. Deferring the NESTED_SERROR_PENDING injection until after the ret <=3D 0 and kvm_vcpu_exit_request() check would avoid mutating vCPU state on aborted entries. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-double_exc= eption_v4-v4-0-523921511673@pereq.eu?part=3D8