From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 952C4CD343F for ; Thu, 7 May 2026 14:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UjHSCZCuv+HNUns/9LrnXeh6eQR8x7ShND8J080fXTg=; b=o+9OeJPBvMHFWvLwcueq19WbtZ 2lSwG30ONpilY4lekwIBz+csFJPWxhFIz1tmThtdO38UWc2afF85z6Bf2EiS5X424EUBVmMKf2DbL fIxKt2X18URWKWsAE0Jl2O5GrT+QicoEu95rJPX4Rlybsx1I+qRkJwJ4vT775+6rXNnTzWaVlgDJR wxggZO2j90QYCffGGo+sdVRDISWRFBRojeq7gAC96i8jOLJCR20ytBpTaZBDMTAGyEu5qWzg3fwZU vf/08MAH8mHfPtTJdMFLTdjqGxZ2AZ5Lb2fZnXpFIENwF4dX6jKz3gt4olzXSBYSAs+MKVWMOXQ7V +L7G3TWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKzbt-000000043A6-0TxC; Thu, 07 May 2026 14:21:53 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKzbq-0000000439T-2m5I for linux-arm-kernel@lists.infradead.org; Thu, 07 May 2026 14:21:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id A178943794; Thu, 7 May 2026 14:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A0CFC2BCB2; Thu, 7 May 2026 14:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778163709; bh=P0H9eJ90fUMEkkCV+29Z8bd2rVGB3vlQyBvoTWdLWZ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZOB+l9s6sC5WOBnDpfFqN4dootjuZeqjR9JCFU7wMCVSN0nvnc7CqcPY6Ys8MLSGC dMmjJubMLmg/7ZDLsI//iZO01QeX8V5PzcnoaihE+ABpDyvT3MTBfIoeFHbiPoapWO Be+Loz6rurZ+QSrbC/pRTY5Tzuq8xSYeC4+drn6bO0zAcCEaaq0mYl+wgbU3OnRqtd A/5C+UW5XyKCLij7BdQ5PxDWxF3n4ln9QGdG078PMzMF+raZOnOmWGj5qP/56rnh10 HMFsgTcyLMTMGOEY5NqmZsbVc5vBsWTIiTFYOIsHNMafS3ccI8eZEIuvgjiy0H6Tx0 07hV2+ZxiXGaQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-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 1wKzbn-00000000fCH-07vS; Thu, 07 May 2026 14:21:47 +0000 Date: Thu, 07 May 2026 15:21:46 +0100 Message-ID: <86qznnxptx.wl-maz@kernel.org> From: Marc Zyngier To: Sebastian Ene Cc: catalin.marinas@arm.com, oupton@kernel.org, will@kernel.org, joey.gouly@arm.com, korneld@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, mrigendra.chaubey@gmail.com, perlarsen@google.com, suzuki.poulose@arm.com, vdonnefort@google.com, yuzenghui@huawei.com, Sudeep Holla Subject: Re: [PATCH] KVM: arm64: Forward FFA_NOTIFICATION* calls to TrustZone In-Reply-To: References: <20260501114447.2389222-2-sebastianene@google.com> <86wlxgy00t.wl-maz@kernel.org> <86se83xrwx.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) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: sebastianene@google.com, catalin.marinas@arm.com, oupton@kernel.org, will@kernel.org, joey.gouly@arm.com, korneld@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, android-kvm@google.com, mrigendra.chaubey@gmail.com, perlarsen@google.com, suzuki.poulose@arm.com, vdonnefort@google.com, yuzenghui@huawei.com, sudeep.holla@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260507_072150_740205_90E80A2C X-CRM114-Status: GOOD ( 42.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 07 May 2026 15:13:06 +0100, Sebastian Ene wrote: > > On Thu, May 07, 2026 at 02:36:46PM +0100, Marc Zyngier wrote: > > On Thu, 07 May 2026 11:48:46 +0100, > > Sebastian Ene wrote: > > > > > > On Wed, May 06, 2026 at 05:29:22PM +0100, Marc Zyngier wrote: > > > > > > Hello Marc, > > > > > > > [+ Sudeep] > > > > > > > > On Fri, 01 May 2026 12:44:48 +0100, > > > > Sebastian Ene wrote: > > > > > > > > > > Remove the FFA_NOTIFICATION* calls from the blocklist used by the pKVM > > > > > FF-A proxy. This restriction was preventing the use of asynchronous > > > > > signaling mechanisms defined by the Arm FF-A specification to > > > > > communicate with the secure services. > > > > > While these calls are markes as optional, there is no reason why the > > > > > hypervisor proxy would block them because: > > > > > > > > > > 1. Host is the Sole Non-Secure Endpoint: The Host operates as the > > > > > only Non-Secure VM ID (VM ID 0) recognized by the Secure World. > > > > > > > > Where is this enforced? > > > > > > > > > > There is no enforcement in place in the hypervisor since we don't proxy > > > FF-A from guest VMs, there is only one non-secure user of this which is the host. > > > > And again: what makes that VM ID 0? Why can't the host pick VM ID 32 > > and use that? > > > > The host discovers its id through the FFA_ID_GET and TZ returns 0 in Does it? How do you verify this? > this case. However if it wants to use VM ID 32 in any other call it > absolutely can but what would it be the attack here, what is your > concern ? Let's be clear: I don't give a damn about a potential attack vector. The moment you add Secure to the mix, security is gone (funny, isn't it?). I care about being strict about the spec, and not letting through things that will eventually break. > > > > > > Because all forwarded notifications are inherently attributed to > > > > > the Host by the SPMC, there is no risk of VM ID spoofing > > > > > originating from the Normal World. > > > > > > > > I don't understand: either the host is always using VM ID 0, and we > > > > have ways to check and enforce this (how?), or the simple fact that > > > > the request comes from NS is a guarantee that the SPMC will treat the > > > > VM ID as 0. > > > > > > > > Which one is it? > > > > > > My understanding is that when the hypervisor doesn't handle the allocation of > > > the non-secure IDs (through FFA_ID_GET), everything that comes from non-secure > > > is treated as having the VM ID 0 by the SPMC. > > > > This looks terribly fragile. I'd rather you *enforce* these things > > rather than allowing any random stuff from the host and relying on > > the EL3 firmware to get it right (odds are that it won't). > > > > I can verify the vmid is 0 for the notification calls that I enable. Yes, please. > > > This also ties into this: > > > > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > > > > > index 1af722771178..a82d0cd22a17 100644 > > > > > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > > > > > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > > > > > @@ -675,14 +675,6 @@ static bool ffa_call_supported(u64 func_id) > > > > > case FFA_RXTX_MAP: > > > > > case FFA_MEM_DONATE: > > > > > case FFA_MEM_RETRIEVE_REQ: > > > > > - /* Optional notification interfaces added in FF-A 1.1 */ > > > > > - case FFA_NOTIFICATION_BITMAP_CREATE: > > > > > - case FFA_NOTIFICATION_BITMAP_DESTROY: > > > > > - case FFA_NOTIFICATION_BIND: > > > > > - case FFA_NOTIFICATION_UNBIND: > > > > > - case FFA_NOTIFICATION_SET: > > > > > - case FFA_NOTIFICATION_GET: > > > > > - case FFA_NOTIFICATION_INFO_GET: > > > > > /* Optional interfaces added in FF-A 1.2 */ > > > > > case FFA_MSG_SEND_DIRECT_REQ2: /* Optional per 7.5.1 */ > > > > > case FFA_MSG_SEND_DIRECT_RESP2: /* Optional per 7.5.1 */ > > > > > > > > Shouldn't these be sanitised in a way? A bunch of registers are SBZ in > > > > the spec, and I'd expect this to be enforced. > > > > which still remains unanswered. > > Missed this sorry. We can reject them in the hyp proxy if the caller > uses non zero values in those registers. I think we need that indeed. M. -- Without deviation from the norm, progress is not possible.