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]
Message-ID: <185d2a6c0317fe74fdb449df62dbafcb922a74f3.camel@intel.com>
Date: Tue, 13 Aug 2024 05:26:06 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Gao, Chao" <chao.gao@...el.com>, "Edgecombe, Rick P"
	<rick.p.edgecombe@...el.com>
CC: "Li, Xiaoyao" <xiaoyao.li@...el.com>, "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>, "pbonzini@...hat.com" <pbonzini@...hat.com>,
	"seanjc@...gle.com" <seanjc@...gle.com>, "isaku.yamahata@...il.com"
	<isaku.yamahata@...il.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "tony.lindgren@...ux.intel.com"
	<tony.lindgren@...ux.intel.com>
Subject: Re: [PATCH 10/25] KVM: TDX: Initialize KVM supported capabilities
 when module setup

On Tue, 2024-08-13 at 11:25 +0800, Chao Gao wrote:
> > +	for (i = 0; i < td_conf->num_cpuid_config; i++) {
> > +		struct kvm_tdx_cpuid_config source = {
> > +			.leaf = (u32)td_conf->cpuid_config_leaves[i],
> > +			.sub_leaf = td_conf->cpuid_config_leaves[i] >> 32,
> > +			.eax = (u32)td_conf->cpuid_config_values[i].eax_ebx,
> > +			.ebx = td_conf->cpuid_config_values[i].eax_ebx >> 32,
> > +			.ecx = (u32)td_conf->cpuid_config_values[i].ecx_edx,
> > +			.edx = td_conf->cpuid_config_values[i].ecx_edx >> 32,
> > +		};
> > +		struct kvm_tdx_cpuid_config *dest =
> > +			&kvm_tdx_caps->cpuid_configs[i];
> > +
> > +		memcpy(dest, &source, sizeof(struct kvm_tdx_cpuid_config));
> 
> this memcpy() looks superfluous. does this work?
> 
> 		kvm_tdx_caps->cpuid_configs[i] = {
> 			.leaf = (u32)td_conf->cpuid_config_leaves[i],
> 			.sub_leaf = td_conf->cpuid_config_leaves[i] >> 32,
> 			.eax = (u32)td_conf->cpuid_config_values[i].eax_ebx,
> 			.ebx = td_conf->cpuid_config_values[i].eax_ebx >> 32,
> 			.ecx = (u32)td_conf->cpuid_config_values[i].ecx_edx,
> 			.edx = td_conf->cpuid_config_values[i].ecx_edx >> 32,
> 		};

This looks good to me.  I didn't try to optimize because it's done in the
module loading time.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ