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:   Mon, 8 Jul 2019 15:05:13 +0800
From:   Jing Liu <jing2.liu@...ux.intel.com>
To:     Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Subject: Re: [PATCH 1/5] KVM: cpuid: do_cpuid_ent works on a whole CPUID
 function

Hi Paolo,

On 7/4/2019 10:07 PM, Paolo Bonzini wrote:
> Rename it as well as __do_cpuid_ent and __do_cpuid_ent_emulated to have
> "func" in its name, and drop the index parameter which is always 0.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
>   arch/x86/kvm/cpuid.c | 89 +++++++++++++++++++++-----------------------
>   1 file changed, 42 insertions(+), 47 deletions(-)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 004cbd84c351..ddffc56c39b4 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -294,14 +294,19 @@ static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>   {
>   	entry->function = function;
>   	entry->index = index;
> +	entry->flags = 0;
> +

I'm wondering if we need set entry->flags = 0 here?
entry->flags was initialized as zero when vzalloc.

>   	cpuid_count(entry->function, entry->index,
>   		    &entry->eax, &entry->ebx, &entry->ecx, &entry->edx);
> -	entry->flags = 0;
>   }
>   
> -static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
> -				   u32 func, u32 index, int *nent, int maxnent)
> +static int __do_cpuid_func_emulated(struct kvm_cpuid_entry2 *entry,
> +				    u32 func, int *nent, int maxnent)
>   {
> +	entry->function = func;
> +	entry->index = 0;
> +	entry->flags = 0;
> +

The same question for flags and index, because entry is allocated
by vzalloc.

>   	switch (func) {
>   	case 0:
>   		entry->eax = 7;
> @@ -313,21 +318,18 @@ static int __do_cpuid_ent_emulated(struct kvm_cpuid_entry2 *entry,
>   		break;
>   	case 7:
>   		entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
> -		if (index == 0)
> -			entry->ecx = F(RDPID);
> +		entry->eax = 0;
> +		entry->ecx = F(RDPID);
>   		++*nent;
>   	default:
>   		break;
>   	}
>   
> -	entry->function = func;
> -	entry->index = index;
> -
>   	return 0;
>   }
>   


Thanks,
Jing

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ