[PATCH] KVM/arm64: Don't emulate a PMU for 32-bit guests if feature not set
Alexandru Elisei
alexandru.elisei at arm.com
Tue Apr 26 02:30:18 PDT 2022
Hi,
On Mon, Apr 25, 2022 at 06:14:13PM +0100, Marc Zyngier wrote:
> [+ 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.
I agree. This patch is just a band-aid.
> 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).
I'll have a look.
Thanks,
Alex
>
> 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