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:   Thu, 6 Feb 2020 11:17:19 -0800
From:   Krish Sadhukhan <krish.sadhukhan@...cle.com>
To:     Eric Auger <eric.auger@...hat.com>, eric.auger.pro@...il.com,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        pbonzini@...hat.com, vkuznets@...hat.com
Cc:     thuth@...hat.com, drjones@...hat.com, wei.huang2@....com
Subject: Re: [PATCH v4 1/3] selftests: KVM: Replace get_gdt/idt_base() by
 get_gdt/idt()


On 2/6/20 2:47 AM, Eric Auger wrote:
> get_gdt_base() and get_idt_base() only return the base address
> of the descriptor tables. Soon we will need to get the size as well.
> Change the prototype of those functions so that they return
> the whole desc_ptr struct instead of the address field.
>
> Signed-off-by: Eric Auger <eric.auger@...hat.com>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>
>
> ---
>
> v3 -> v4:
> - Collected R-b's
> ---
>   tools/testing/selftests/kvm/include/x86_64/processor.h | 8 ++++----
>   tools/testing/selftests/kvm/lib/x86_64/vmx.c           | 6 +++---
>   2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index aa6451b3f740..6f7fffaea2e8 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -220,20 +220,20 @@ static inline void set_cr4(uint64_t val)
>   	__asm__ __volatile__("mov %0, %%cr4" : : "r" (val) : "memory");
>   }
>   
> -static inline uint64_t get_gdt_base(void)
> +static inline struct desc_ptr get_gdt(void)
>   {
>   	struct desc_ptr gdt;
>   	__asm__ __volatile__("sgdt %[gdt]"
>   			     : /* output */ [gdt]"=m"(gdt));
> -	return gdt.address;
> +	return gdt;
>   }
>   
> -static inline uint64_t get_idt_base(void)
> +static inline struct desc_ptr get_idt(void)
>   {
>   	struct desc_ptr idt;
>   	__asm__ __volatile__("sidt %[idt]"
>   			     : /* output */ [idt]"=m"(idt));
> -	return idt.address;
> +	return idt;
>   }
>   
>   #define SET_XMM(__var, __xmm) \
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/vmx.c b/tools/testing/selftests/kvm/lib/x86_64/vmx.c
> index 85064baf5e97..7aaa99ca4dbc 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/vmx.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/vmx.c
> @@ -288,9 +288,9 @@ static inline void init_vmcs_host_state(void)
>   	vmwrite(HOST_FS_BASE, rdmsr(MSR_FS_BASE));
>   	vmwrite(HOST_GS_BASE, rdmsr(MSR_GS_BASE));
>   	vmwrite(HOST_TR_BASE,
> -		get_desc64_base((struct desc64 *)(get_gdt_base() + get_tr())));
> -	vmwrite(HOST_GDTR_BASE, get_gdt_base());
> -	vmwrite(HOST_IDTR_BASE, get_idt_base());
> +		get_desc64_base((struct desc64 *)(get_gdt().address + get_tr())));
> +	vmwrite(HOST_GDTR_BASE, get_gdt().address);
> +	vmwrite(HOST_IDTR_BASE, get_idt().address);
>   	vmwrite(HOST_IA32_SYSENTER_ESP, rdmsr(MSR_IA32_SYSENTER_ESP));
>   	vmwrite(HOST_IA32_SYSENTER_EIP, rdmsr(MSR_IA32_SYSENTER_EIP));
>   }

Nit: The commit message header can be made better to reflect the correct 
function names. For example,

     Replace get_[gdt | idt]_base() with get_[gdt | idt]()


With that,

     Reviewed-by: Krish Sadhukhan <krish.sadhukhan@...cle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ