lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/6] KVM: x86/pmu: Setup pmc->eventsel for fixed PMCs
From
On 12/9/21 19:53, Jim Mattson wrote:
>> How do we know that i < size? For example, Ice Lake supports 4 fixed
>> counters, but fixed_pmc_events only has three entries.
>
> We don't, and it's a preexisting bug in intel_pmu_refresh.
> As Like points out, KVM_GET_SUPPORTED_CPUID indicates that only three
> fixed counters are supported. So, per the KVM contract, if userspace
> configures four in the guest cpuid info, all bets are off.

Out of bounds accesses are not part of the contract though, even if
squashed by an unorthodox use of array_index_nospec. So I'll post my hack.

> I don't like that contract, but changing it means introducing KVM_SET_CPUID3.

And especially it means getting it right, which is the difficult part.

Paolo

\
 
 \ /
  Last update: 2021-12-09 19:58    [W:0.119 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site