From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 DC64133B6DF; Wed, 15 Jul 2026 16:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784133720; cv=none; b=T0gyyJ1mqKuOekJKURbh3xpuftK9X27vDlepa1orQJlyPnlUCrT/txKNDhWvnGtip/Ua97z1rxRzdcqHYipKAKPwqIGroMl1b5jG3xVQTy1DIjQIeX/Pjb0lDOSBuQc3zDGgR6bniuPtZDKL3mABn7nFVOJCP8bu8rwrh2reHQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784133720; c=relaxed/simple; bh=348JL7dYcCCki1uwQP2UBb0BHGDXT+kRe/XqtmMSTHg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=hCwMplXFSpq58QmMXWxRJWao888WDC0U2Sg1x6V3pfbfGtRbGGwbzSNxPG34BURnughhh+TYpVeQH8iX+frsJuvu16PO+CG6kHoL3DhmRcDG0snwCF9VTT89wqxYsoMq1RTdc5d2vtsOdY806EHv5ubKU4KX+AgIRl2YF7YmACg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XtdvtGYg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XtdvtGYg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75F671F000E9; Wed, 15 Jul 2026 16:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784133718; bh=dPElEHX+3/lXieNyqnUo3IVGh0C4XsrczWIUTURM1+Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=XtdvtGYgoUCUQbJtdoFkVkBCYnqvZuMadVq9N+47ZrMiY0gJ/ng0uQLBUzhQquI2g Guf/6bCEQbUU/wi6VKEEJyhtVDYE69aWCAtZYkrdwmxt13zRVvN4vEtktU27OMM2Je jth3RLRekceOZed3sO6B8oOtW6ZUADv/uHPUHJy7WWXWxQZXgbqJmyJ2g46j3dOZOy aN2HqfWAQZPqRi4Yxm5mRRyPnCgNXC0fnQ4f9S5AekNuqgOCn0hwwpb4azIqsAS5LP cvXIkAHsOf7j4BAw5lTW/ny9lXSHj3+d2o+s7ehNWZ2c6pj2qsRP0TfHlvxpRWww7H wHmlr96kXdHJg== Received: from [194.56.92.2] (helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wk2gG-00000005P2D-174K; Wed, 15 Jul 2026 16:41:56 +0000 Date: Wed, 15 Jul 2026 17:43:45 +0100 Message-ID: <87wluw430e.wl-maz@kernel.org> From: Marc Zyngier To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo Pieralisi Subject: Re: [PATCH v15 26/37] KVM: arm64: WARN on injected undef exceptions In-Reply-To: References: <20260715142841.80544-1-steven.price@arm.com> <20260715142841.80544-27-steven.price@arm.com> <8733xk5k7v.wl-maz@kernel.org> <87y0fc43ut.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 194.56.92.2 X-SA-Exim-Rcpt-To: steven.price@arm.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joey.gouly@arm.com, alexandru.elisei@arm.com, christoffer.dall@arm.com, tabba@google.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, gshan@redhat.com, sdonthineni@nvidia.com, alpergun@google.com, aneesh.kumar@kernel.org, fj0570is@fujitsu.com, vannapurve@google.com, WeiLin.Chang@arm.com, lpieralisi@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 15 Jul 2026 17:31:57 +0100, Steven Price wrote: > > On 15/07/2026 17:25, Marc Zyngier wrote: > > On Wed, 15 Jul 2026 17:15:31 +0100, > > Steven Price wrote: > >> > >> On 15/07/2026 16:46, Marc Zyngier wrote: > >>> On Wed, 15 Jul 2026 15:28:28 +0100, > >>> Steven Price wrote: > >>>> > >>>> The RMM doesn't allow injection of a undefined exception into a realm > >>>> guest. Add a WARN to catch if this ever happens. > >>>> > >>>> Signed-off-by: Steven Price > >>>> Reviewed-by: Gavin Shan > >>>> Reviewed-by: Suzuki K Poulose > >>>> --- > >>>> Changes since v6: > >>>> * if (x) WARN(1, ...) makes no sense, just WARN(x, ...)! > >>>> --- > >>>> arch/arm64/kvm/inject_fault.c | 1 + > >>>> 1 file changed, 1 insertion(+) > >>>> > >>>> diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c > >>>> index 6492397b73d7..613f223bc7a3 100644 > >>>> --- a/arch/arm64/kvm/inject_fault.c > >>>> +++ b/arch/arm64/kvm/inject_fault.c > >>>> @@ -327,6 +327,7 @@ void kvm_inject_size_fault(struct kvm_vcpu *vcpu) > >>>> */ > >>>> void kvm_inject_undefined(struct kvm_vcpu *vcpu) > >>>> { > >>>> + WARN(vcpu_is_rec(vcpu), "Unexpected undefined exception injection to REC"); > >>>> if (vcpu_el1_is_32bit(vcpu)) > >>>> inject_undef32(vcpu); > >>>> else > >>> > >>> No. WARN_ONCE at a push, but even then, this looks dodgy. > >> > >> Yep WARN_ONCE() would be better. This function should never be called > >> for a realm guest. > >> > >>> Exceptions must be injectable. Otherwise, how do you respond to, for > >>> example, a sysreg access for a feature that is hidden from the guest? > >> > >> The RMM doesn't allow the host to inject exceptions - with the exception > >> of SEA after a host-emulated MMIO. > >> > >>> Will the RMM perform this in KVM's stead? > >> > >> Yes the RMM would have to handle this for the likes of sysreg accesses. > >> The host doesn't control the trapping of sysreg accesses. There are a > >> few GIC-related registers which are forwarded to the host ("REC exit due > >> to system register access") but generally the handling of sysregs is > >> entirely internal to the RMM. > > > > Then the only option is not to just warn, but to mark all realms as > > dead and refuse to run them any further. If we can't inject an > > exception and that the RMM isn't doing its job, I can't see how we can > > continue at all. > > You've got a point - I'm not sure whether it's entirely reasonable to > refuse to run any realm, but it certainly would be sensible to mark the If the RMM is not playing ball by not doing its part of the bargain, the only sane option is stop talking to it immediately. Who knows what else the implementation got wrong? > guest which triggers this as dead. Would a KVM_BUG() be more appropriate > here? That's the absolutely minimal option. Not necessarily the safe one. M. -- Jazz isn't dead. It just smells funny.