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: <d75130b0a0fb9602fa8712a620cb1f7e52606ea4.camel@intel.com>
Date: Mon, 13 Oct 2025 22:08:36 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "seanjc@...gle.com" <seanjc@...gle.com>, "x86@...nel.org"
	<x86@...nel.org>, "kas@...nel.org" <kas@...nel.org>,
	"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
	"mingo@...hat.com" <mingo@...hat.com>, "tglx@...utronix.de"
	<tglx@...utronix.de>, "bp@...en8.de" <bp@...en8.de>, "pbonzini@...hat.com"
	<pbonzini@...hat.com>
CC: "Gao, Chao" <chao.gao@...el.com>, "Huang, Kai" <kai.huang@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Williams, Dan
 J" <dan.j.williams@...el.com>, "Hunter, Adrian" <adrian.hunter@...el.com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "linux-coco@...ts.linux.dev"
	<linux-coco@...ts.linux.dev>, "xin@...or.com" <xin@...or.com>
Subject: Re: [RFC PATCH 2/4] KVM: x86: Extract VMXON and EFER.SVME enablement
 to kernel

On Fri, 2025-10-10 at 15:04 -0700, Sean Christopherson wrote:

> +
> +int x86_virt_get_cpu(int feat)
> +{
> +	int r;
> +
> +	if (!x86_virt_initialized)
> +		return -EOPNOTSUPP;
> +
> +	if (this_cpu_inc_return(virtualization_nr_users) > 1)
> +		return 0;
> +
> +	if (x86_virt_is_vmx() && feat == X86_FEATURE_VMX)
> +		r = x86_vmx_get_cpu();
> +	else if (x86_virt_is_svm() && feat == X86_FEATURE_SVM)
> +		r = x86_svm_get_cpu();
> +	else
> +		r = -EOPNOTSUPP;
> +
> +	if (r)
> +		WARN_ON_ONCE(this_cpu_dec_return(virtualization_nr_users));
> +
> +	return r;
> +}
> +EXPORT_SYMBOL_GPL(x86_virt_get_cpu);

Not sure if I missed some previous discussion or future plans, but doing this
via X86_FEATURE_FOO seems excessive. We could just have x86_virt_get_cpu(void)
afaict? Curious if there is a plan for other things to go here?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ