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 1724E4071C8; Sun, 7 Jun 2026 17:44:25 +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=1780854267; cv=none; b=AARuHFXChIekip6wCKyPH+YA/Fmw+Qc8hsKSl/x0bHmA7aLMdtZ3wDPuxeRkqpk7p3Gl47iOlgB0QqbGilslh490Hj4rKzO+IA2KYPe72K2T82w8XUuB43fLaANCq0lZz4ZnUwuNna8OXDt8LbmScaScNTIn0YzWxaXuJODilNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780854267; c=relaxed/simple; bh=QHypmY4ge/l+NjenpNtvbBJhADhh4UH25TvD+km9JgE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=PQ+pnRREkRIAOH3WjjVGdIlocx8hu/C5cxg4N3p5bjpkQLh8s0wc6kmHBWn8B69idvLwtdsL6PFBzU41TJRCZvk254VjzrczTxEQ6KbYb22Tg8sjDyUQwBMtwF9BSeu88wUJ02xuAQzcWLcKSjtb/jR650NfEssiR7xzYUJihdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dG+CrWMK; 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="dG+CrWMK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C23E1F00893; Sun, 7 Jun 2026 17:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780854265; bh=LcGidTryxXIrkucPGMJRWxmrwfef6Dfp5it1Q+8cR+8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=dG+CrWMKPXvOSJKfcRnH3BokFt+VnCwfLRdhwC8uNE+W78AwjfDkeySPJY7X5XmhC bxTx5PB4M2MbsivSDXb3nmZFhI3POyDLSKG+KdZ9/UMDAIjwBsbi7cOC6SXXCXcY7E ZWH/THR3+b1FfPqyVwxGHE29qAzjxZfxiZQFAjh0N/4YwPZ1ez9sl7kE4xmNK67nE9 b1gOk4cPJSCEawzDMierp275x3mKxLO1W615PXpbEiaKG07na8vQwpcej4HBFwzIxI 3Z2MphhR9giIS/W/n+USr+hfALcwB5LMsaoGlW7w45sl5aENdGHPzuYm1rFoXc5cMG iXUH/zXEvrfSA== Received: from sofa.misterjones.org ([185.219.108.64] 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 1wWHXr-0000000AEFI-2ocd; Sun, 07 Jun 2026 17:44:23 +0000 Date: Sun, 07 Jun 2026 18:47:44 +0100 Message-ID: <87y0gq8cov.wl-maz@kernel.org> From: Marc Zyngier To: Greg Kroah-Hartman Cc: stable@vger.kernel.org, patches@lists.linux.dev, Mark Brown Subject: Re: [PATCH 6.18 141/315] KVM: arm64: Correctly cap ZCR_EL2 provided by a guest hypervisor In-Reply-To: <20260607095732.780900893@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> <20260607095732.780900893@linuxfoundation.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: patches@lists.linux.dev 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: 185.219.108.64 X-SA-Exim-Rcpt-To: gregkh@linuxfoundation.org, stable@vger.kernel.org, patches@lists.linux.dev, broonie@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 Sun, 07 Jun 2026 10:58:48 +0100, Greg Kroah-Hartman wrote: > > 6.18-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Mark Brown > > commit 83726330748981372bde86ed5411d7b306612991 upstream. > > ZCR_EL2 can be updated by a VHE guest hypervisor either using ZCR_EL2 > (which traps) or ZCR_EL1 (which does not trap). KVM handles both in > different way: > > - on ZCR_EL2 trap, ZCR_EL2.LEN is immediately capped at the VM's own > VL limit. This has the potential to break existing SW that relies > on the full LEN field to be stateful. > > - on ZCR_EL1 access, we do absolutely nothing. > > On restoring the SVE context for an L2 guest, we directly restore the > guest hypervisor's view of ZCR_EL2 into the physical ZCR_EL2. If the > guest's view of the register was updated using the ZCR_EL2 accessor, > the value has already been sanitised (with the caveat mentioned above). > > But if the guest used ZCR_EL1, the raw value is written into the HW, > and the L2 guest can now access VLs that it shouldn't. > > Fix all the above by moving the VL capping to the restore points, > ensuring that: > > - the HW is always programmed with a capped value, irrespective of > the accessor being used, > > - the ZCR_EL2.LEN field is always completely stateful, irrespective > of the accessor being used. > > Additionally, move ZCR_EL2 to be a sanitised register, ensuring that > only the LEN field is actually stateful. This requires some creative > construction of the RES0 mask, as the sysreg generation script does > not yet generate RAZ/WI fields. > > Fixes: b3d29a823099 ("KVM: arm64: nv: Handle ZCR_EL2 traps") > Signed-off-by: Mark Brown > Cc: stable@vger.kernel.org > Link: https://patch.msgid.link/20260529-kvm-arm64-fix-zcr-len-nv-v2-1-86cad51992bd@kernel.org > [maz: rewrote commit message, tidy up access_zcr_el2()] > Signed-off-by: Marc Zyngier > Signed-off-by: Greg Kroah-Hartman As pointed out by Miguel at [1], this doesn't backport cleanly before 7.0. I'll provide a backport separately, so please drop this for now. Thanks, M. [1] https://lore.kernel.org/r/20260607170440.90814-1-ojeda@kernel.org -- Jazz isn't dead. It just smells funny.