Re: [PATCH v4 0/6] KVM: x86: Fix unpermitted XTILE CPUID reporting

From: Aaron Lewis
Date: Tue Apr 11 2023 - 10:04:56 EST


On Mon, Apr 10, 2023 at 5:34 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Tue, Apr 04, 2023, Sean Christopherson wrote:
> > This is v4 of Aaron's "Clean up the supported xfeatures" series.
> >
> > Fix a bug where KVM treats/reports XTILE_CFG as supported without
> > XTILE_DATA being supported if userspace queries the supported CPUID but
> > doesn't request access to AMX, a.k.a. XTILE_DATA. If userspace reflects
> > that CPUID info back into KVM, the resulting VM may use it verbatim and
> > attempt to shove bad data into XCR0: XTILE_CFG and XTILE_DATA must be
> > set/cleared as a pair in XCR0, despite being enumerated separately.
> >
> > This is effectively compile-tested only on my end.
>
> Aaron, can you give this series a quick spin (and review) to make sure it works
> as intended? I'd like to get this into 6.4, but I'd really like it to be tested
> on AMX hardware first.

LGTM. I ran the test on SPR and it worked as intended. I also tried
it with the dynamic feature enabled, i.e. XTILEDATA, and that also
worked as expected.

The first run the guest XCR0 was 0x2e7 and all tests passed. The
second run the guest XCR0 was 0x602e7 and all tests passed again.

Reviewed-by: Aaron Lewis <aaronlewis@xxxxxxxxxx>
Tested-by: Aaron Lewis <aaronlewis@xxxxxxxxxx>