lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Nov 2017 12:21:37 -0600
From:   "Natarajan, Janakarajan" <Janakarajan.Natarajan@....com>
To:     Borislav Petkov <bp@...e.de>, Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krcmar <rkrcmar@...hat.com>
Cc:     kvm@...r.kernel.org, x86@...nel.org, linux-kernel@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>, Len Brown <len.brown@...el.com>,
        Kyle Huey <me@...ehuey.com>, Kan Liang <Kan.liang@...el.com>,
        Grzegorz Andrejczuk <grzegorz.andrejczuk@...el.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH v2 3/4] Add support for AMD Core Perf Extension in guest

On 11/17/2017 5:44 AM, Borislav Petkov wrote:
> On Thu, Nov 16, 2017 at 12:00:11PM -0600, Natarajan, Janakarajan wrote:
>> Ah my apologies. So when the pmu is initialized the cpuid entries
>> aren't available then.
> So let's see:
>
> ... kvm_arch_vcpu_create() ->
> svm_create_vcpu() ->
> kvm_vcpu_init() ->
> kvm_arch_vcpu_init() ->
>
> <--- HERE
>
> kvm_pmu_init()
>
> But at HERE in kvm_arch_vcpu_init() right before kvm_pmu_init() we do already query
> cpuid:
>
> 	vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);

cpuid_query_maxphyaddr first checks for for the 0x80000008 cpuid entry, 
and if it can't find it
returns a default value of 36.

When invoked in the kvm_arch_vcpu_init(), the default is being returned. 
The vcpu->arch.maxphyaddr
is later updated in the kvm_update_cpuid(), which in my case was setting 
the maxphyaddr to 40.
I believe the cpuid entry is not available when invoked in the init call 
and a default value is
being used as a placeholder until the entries are updated by qemu.

> so it's not like we don't know about cpuid leafs at that point. Which
> would mean that the code can be made to set the CPU family earlier,
> before kvm_pmu_init() runs so that you have the proper CPU family and
> thus have this thing properly designed.
>
> Maybe Paolo and Radim have a better suggestion here...
>

Powered by blists - more mailing lists