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  linux-hardening  linux-cve-announce  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:   Tue, 21 Mar 2017 10:15:23 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Wanpeng Li <kernellwp@...il.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        kvm <kvm@...r.kernel.org>, Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [PATCH v2 2/3] KVM: VMX: Fix enable VPID even if INVVPID is not
 exposed in vmx capability


>>> Cc: Paolo Bonzini <pbonzini@...hat.com>
>>> Cc: Radim Krčmář <rkrcmar@...hat.com>
>>> Signed-off-by: Wanpeng Li <wanpeng.li@...mail.com>
>>> ---
>>>  arch/x86/kvm/vmx.c | 9 ++++++++-
>>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>> index 06d8080..b310214 100644
>>> --- a/arch/x86/kvm/vmx.c
>>> +++ b/arch/x86/kvm/vmx.c
>>> @@ -1239,6 +1239,11 @@ static inline bool cpu_has_vmx_invvpid_global(void)
>>>       return vmx_capability.vpid & VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
>>>  }
>>>
>>> +static inline bool cpu_has_vmx_invvpid(void)
>>> +{
>>> +     return vmx_capability.vpid & VMX_VPID_INVVPID_BIT;
>>> +}
>>> +
>>>  static inline bool cpu_has_vmx_ept(void)
>>>  {
>>>       return vmcs_config.cpu_based_2nd_exec_ctrl &
>>> @@ -6519,8 +6524,10 @@ static __init int hardware_setup(void)
>>>       if (boot_cpu_has(X86_FEATURE_NX))
>>>               kvm_enable_efer_bits(EFER_NX);
>>>
>>> -     if (!cpu_has_vmx_vpid())
>>> +     if (!cpu_has_vmx_vpid() ||
>>> +             !(cpu_has_vmx_invvpid()))
>>
>> This indentation looks weird. Can't this be fit into one line?
> 
> The same as cpu_has_vmx_ept_4levels().

I only know the general rules:

1. make things fit into one line unless it really harms readability
2. when splitting conditions over multiple lines, make them start at the
same level.

And I said, this indentation looks weird, because 1 and 2 are not met.

Anyhow, the general patch is fine in my opinion.

-- 

Thanks,

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ