lkml.org 
[lkml]   [2020]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 29/61] KVM: x86: Add Kconfig-controlled auditing of reverse CPUID lookups
From
Date
On 24/02/20 14:54, Vitaly Kuznetsov wrote:
>> --- a/arch/x86/kvm/cpuid.h
>> +++ b/arch/x86/kvm/cpuid.h
>> @@ -98,6 +98,11 @@ static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)
>> static __always_inline u32 *__cpuid_entry_get_reg(struct kvm_cpuid_entry2 *entry,
>> const struct cpuid_reg *cpuid)
>> {
>> +#ifdef CONFIG_KVM_CPUID_AUDIT
>> + WARN_ON_ONCE(entry->function != cpuid->function);
>> + WARN_ON_ONCE(entry->index != cpuid->index);
>> +#endif
>> +
>> switch (cpuid->reg) {
>> case CPUID_EAX:
>> return &entry->eax;
> Honestly, I was thinking we should BUG_ON() and even in production builds
> but not everyone around is so rebellious I guess, so

BUG_ON is too much, but I agree the cost is so small that unconditional
WARN_ON makes sense.

Paolo

\
 
 \ /
  Last update: 2020-02-25 16:01    [W:1.987 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site