[PATCH v2 2/4] KVM: arm64: Trap TCR2_EL1 writes when S1PIE or S1POE is hidden
Dan Carpenter
dan at pereq.eu
Thu Nov 19 21:33:00 PST 2026
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 at 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 at vger.kernel.org
> > Signed-off-by: Dan Carpenter <dan at 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. 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?"
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.
regards,
dan carpenter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: marc-review-checklist.md
Type: text/markdown
Size: 5347 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261120/2af911bb/attachment-0001.md>
More information about the linux-arm-kernel
mailing list