[PATCH v2 06/25] KVM: arm64: nv: Add sanitising to VNCR-backed HCRX_EL2

Oliver Upton oliver.upton at linux.dev
Fri Feb 2 09:15:51 PST 2024


On Fri, Feb 02, 2024 at 02:56:50PM +0000, Marc Zyngier wrote:
> No amount of warnings will do, because people don't give a damn.
> 
> I'm actually in favour of something far more radical: we snapshot the
> raw value of all the used RES0/1, and put BUILD_BUG_ON()s that fire if
> any value has changed. They will have to touch the KVM code to fix
> that, and we catch them red-handed.

Oh I like that a lot more.

> > 
> > > +	if (!kvm_has_feat(kvm, ID_AA64ISAR3_EL1, PACM, TRIVIAL_IMP))
> > > +		res0 |= HCRX_EL2_PACMEn;
> > > +	if (!kvm_has_feat(kvm, ID_AA64PFR2_EL1, FPMR, IMP))
> > > +		res0 |= HCRX_EL2_EnFPM;
> > > +	if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, GCS, IMP))
> > > +		res0 |= HCRX_EL2_GCSEn;
> > > +	if (!kvm_has_feat(kvm, ID_AA64ISAR2_EL1, SYSREG_128, IMP))
> > > +		res0 |= HCRX_EL2_EnIDCP128;
> > > +	if (!kvm_has_feat(kvm, ID_AA64MMFR3_EL1, ADERR, DEV_ASYNC))
> > > +		res0 |= (HCRX_EL2_EnSDERR | HCRX_EL2_EnSNERR);
> > > +	if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, DF2, IMP))
> > > +		res0 |= HCRX_EL2_TMEA;
> > > +	if (!kvm_has_feat(kvm, ID_AA64MMFR3_EL1, D128, IMP))
> > > +		res0 |= HCRX_EL2_D128En;
> > > +	if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, THE, IMP))
> > > +		res0 |= HCRX_EL2_PTTWI;
> > 
> > Ok, not fair. The latest public version of the ARM ARM doesn't have any
> > of this. Where are you getting it from?
> 
> The bloody XML, from which all of this should, in theory, be extracted
> without any human intervention. Sadly, it seems that we are not
> allowed to do so, from what I have been told.
> 
> The ARM ARM is, unfortunately, being quickly rendered obsolete by the
> lack of updates (FEAT_THE is part of the v9.4 architecture, released
> in 2022).

Ah, got it. Thanks both for the reference. That really sucks though!

-- 
Thanks,
Oliver



More information about the linux-arm-kernel mailing list