[PATCH] KVM/arm64: Don't emulate a PMU for 32-bit guests if feature not set

Marc Zyngier maz at kernel.org
Mon Apr 25 10:14:13 PDT 2022


[+ Oliver]

Hi Alex,

On Mon, 25 Apr 2022 15:55:30 +0100,
Alexandru Elisei <alexandru.elisei at arm.com> wrote:
> 
> kvm->arch.arm_pmu is set when userspace attempts to set the first PMU
> attribute. As certain attributes are mandatory, arm_pmu ends up always
> being set to a valid arm_pmu, otherwise KVM will refuse to run the VCPU.
> However, this only happens if the VCPU has the PMU feature. If the VCPU
> doesn't have the feature bit set, kvm->arch.arm_pmu will be left
> uninitialized and equal to NULL.

Although I'm not opposed to this as an immediate workaround to avoid
the ugly crash, I think sanitising the AArch32 regs is the way to go.
Oliver had a stab at this a few weeks back[1], but this seem to have
stalled.

Could you have a look and see if anything was missing (the patches
needed some rework, but I haven't checked whether DFR0 was correctly
handled or not).

Thanks,

	M.

[1] https://lore.kernel.org/r/20220401010832.3425787-1-oupton@google.com

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list