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=1795166586; b=POqzoT//BxjkmglTadqYCXoDNWDrBy4S0lV4L/QoG10G/fqqKnD0TswAInbjC7Kjv182 sRH6wiMuqXjHSk/7ysANEtxQV4rm2GNGkCvD6cBgicRE5Eib8XzAjxv65L1UekRuIoFOa 9v9M1+TtW/ApOIytAPPMPeQ0tEQ5GUmXLmBqJeqnzNBuGhQBWo8B6QjeUIFt7os5yMLlJ S6FyKtscM5v5ND+HqYEpp5F2wXWRJDMnpA+0LKB0pxigUL9Msw7PNpMqjCbTJ5cCB+hSM EL0YLT8ky6aQWAeM35ASx63G8OI4Z/UETf51goIpDvwJ6xPO7JGV5xOpggPVRSPxxtw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795166586; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=AfH1GwPvGrJnb49hBd7Swpv657+Ce0ghmzuYbAXBdos=; b=Uuo2iXMD5SaBMq5/qJevn2tY+J2KKktHTdhsCxZNE4K02mmiRVvrItHruKQDGG6LFRJo DkimB+50oEar8CXy20UeJhTfuVgL2jjH09DHzFmyhr+oHv4oaMan7mLaZG5zAfAsmnxKy MG5o5n4rMYCcdENoyKJSYQCFGUroP725r40u+N4J0CJGGmBV/lqbtTD/N5U6FHN+0sIbv X+WmFkltudAebDL79wKiegFi1O0xwHriC2T6m9AzfgI0OjFcjR9KJyjXWQyGyaY/iDAE3 uayMstL1zBeBvFv+JI1frMGve92DK9VFU52IWETxq2UjPE9dlzsUykWkdnZVhAHs5iw== 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=mgdcGGza; 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 73392606A320; Fri, 20 Nov 2026 09:23: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=mgdcGGza Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47E711F000C6; Fri, 20 Nov 2026 09:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795166586; bh=AfH1GwPvGrJnb49hBd7Swpv657+Ce0ghmzuYbAXBdos=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=mgdcGGzaEYwRkHecCtznwJ7oFc5Md2hnqBMtgMc17oruVsklPrvGcF4pfq1gzs2xT DmrGchCErF0kZMJqpLPRSvWzN/q01RYKSuoOfXoiIV1V5I5qECMOyT1Mtqa8ioylLz 4gXf73IlHwjKqSL6JDbCQJJ3gZU7IoNABqNGobwmNfLSX52Z55//3JEPt4VIR28Itz CAtNJ0qcmtBNtHKifH9bIRLXRGj//CJhODXFfo5b1qEg/0B9pyh7uegZoNnX7dlvag QSFGCEtkG1QUBRxVo/J2VfF3RlqblgL36gROt0L5OembVfPIm++e8Sm1gwZ9o52kgK Qs7yTkwpFETpA== 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 1xUKpk-00000000tDp-01g9; Fri, 20 Nov 2026 09:23:04 +0000 Date: Fri, 20 Nov 2026 09:23:03 +0000 Message-ID: <86v75rzwjs.wl-maz@kernel.org> From: Marc Zyngier To: Dan Carpenter Cc: Oliver Upton , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Jintack Lim , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Karthik Bhargavan , =?UTF-8?B?Q2zDqW1lbnQ=?= Blaudeau , stable@vger.kernel.org Subject: Re: [PATCH v2 2/4] KVM: arm64: Trap TCR2_EL1 writes when S1PIE or S1POE is hidden In-Reply-To: References: <20261119-nv-tcr2-v2-0-3deb1a6cdba8@pereq.eu> <20261119-nv-tcr2-v2-2-3deb1a6cdba8@pereq.eu> <86wlq8zssf.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) X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: dan@pereq.eu, oupton@kernel.org, fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, jintack.lim@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, karthik@pereq.eu, clement@cryspen.com, stable@vger.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 Fri, 20 Nov 2026 05:33:00 +0000, Dan Carpenter wrote: > > [1 ] > On Thu, Nov 19, 2026 at 04:32:00PM +0000, Marc Zyngier wrote: > > On Thu, 19 Nov 2026 13:25:35 +0000, > > Dan Carpenter wrote: > > > > > > A VMM can offer FEAT_TCR2 to a guest but hide FEAT_S1PIE or FEAT_S1POE, > > > for example this is done to keep the VM migratable. KVM then stops > > > loading the PIR_EL1, PIRE0_EL1 and POR_EL1 registers for that guest. But > > > the guest's writes to the TCR2_EL1 register don't trap, and the CPU still > > > acts on its PIE, POE and E0POE bits. > > > > > > If a guest turned these features on, it would run with the permission > > > settings another VM left on the CPU. Technically this is a kind of > > > information leak and a guest could figure out another guests permission > > > setting based on which accesses fault. > > > > > > For these VMs, set the TCR_EL1 bit in HFGWTR_EL2 so that writes to > > > TCR_EL1 and TCR2_EL1 trap, and clear the hidden bits in a new > > > access_tcr2_el1() handler. > > > > > > Fixes: 58627b722ee2 ("KVM: arm64: Make PIR{,E0}_EL1 UNDEF if S1PIE is not advertised to the guest") > > > Fixes: b86c9bea6349 ("KVM: arm64: Save/restore POE registers") > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Dan Carpenter > > > --- > > > v2: This is a new patch > > > > > > This is only a partial fix, I will update nested virtualization in the > > > next patch and the !vcpu_has_nv(vcpu) condition in __compute_hfgwtr() will > > > go away. > > > > No, I really don't want to go down that road. > > > > Yeah. Thanks, Marc. > > I'm still a KVM newbie. I'm embarrassed I sent that in retrospect. Don't be embarrassed. There is nothing wrong with proposing a solution and being told why it doesn't really work. If anything, you have spotted an interesting problem that we had ignored so far, and forced me into thinking about it. Seems like a net win to me. > I had Claude create a checklist based on analysing your review > comments so I can hopefully get ahead of it a bit. Attached for > your amusement. Apparently 10% of the time your review is "Why?" Oh man. This thing has summed me up, digested me and reduced me to a markdown file. It's 9:15 and I feel like I need a drink... On the other hand, some of this stuff could be used to add more substance to Documentation/process/maintainer-kvm-arm64.rst (which is only on our fixes branch for now, but on its way to Linus). > Also Claude says that it could have found the Sashiko bugs by reviewing > patches to see if any different bugs get exposed by making a fix. We > shall see. > > Btw, I'm still hoping to get you that selftest but I need to send a few > more fixes first. Sure, no worries. Thanks again, M. -- Without deviation from the norm, progress is not possible.