All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Dan Carpenter <dan@pereq.eu>
Cc: "Oliver Upton" <oupton@kernel.org>,
	"Fuad Tabba" <fuad.tabba@linux.dev>,
	"Joey Gouly" <joey.gouly@arm.com>,
	"Steffen Eiden" <seiden@linux.ibm.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Jintack Lim" <jintack.lim@linaro.org>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	"Karthik Bhargavan" <karthik@pereq.eu>,
	"Clément Blaudeau" <clement@cryspen.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 2/4] KVM: arm64: Trap TCR2_EL1 writes when S1PIE or S1POE is hidden
Date: Fri, 20 Nov 2026 09:23:03 +0000	[thread overview]
Message-ID: <86v75rzwjs.wl-maz@kernel.org> (raw)
In-Reply-To: <av_bjCyoM93HColG@stanley.mountain>

On Fri, 20 Nov 2026 05:33:00 +0000,
Dan Carpenter <dan@pereq.eu> wrote:
> 
> [1  <text/plain; us-ascii (7bit)>]
> On Thu, Nov 19, 2026 at 04:32:00PM +0000, Marc Zyngier wrote:
> > On Thu, 19 Nov 2026 13:25:35 +0000,
> > Dan Carpenter <dan@pereq.eu> 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 <dan@pereq.eu>
> > > ---
> > > 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.

  reply	other threads:[~2026-11-20  9:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 13:25 [PATCH v2 0/4] KVM: arm64: nv: Fix AT emulation for nested virtualization Dan Carpenter
2026-11-19 13:25 ` [PATCH v2 1/4] KVM: arm64: nv: Fix AT emulation for TCR2_EL1 Dan Carpenter
2026-11-19 13:25 ` [PATCH v2 2/4] KVM: arm64: Trap TCR2_EL1 writes when S1PIE or S1POE is hidden Dan Carpenter
2026-11-19 16:32   ` Marc Zyngier
2026-11-20  5:33     ` Dan Carpenter
2026-11-20  9:23       ` Marc Zyngier [this message]
2026-11-19 13:25 ` [PATCH v2 3/4] KVM: arm64: nv: Clear hidden TCR2 bits for nested guests Dan Carpenter
2026-11-19 13:25 ` [PATCH v2 4/4] KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86v75rzwjs.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=clement@cryspen.com \
    --cc=dan@pereq.eu \
    --cc=fuad.tabba@linux.dev \
    --cc=jintack.lim@linaro.org \
    --cc=joey.gouly@arm.com \
    --cc=karthik@pereq.eu \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.