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: <aOz8gHzmZ8PdsgNw@intel.com>
Date: Mon, 13 Oct 2025 21:20:00 +0800
From: Chao Gao <chao.gao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
	<x86@...nel.org>, "Kirill A. Shutemov" <kas@...nel.org>, Paolo Bonzini
	<pbonzini@...hat.com>, <linux-kernel@...r.kernel.org>,
	<linux-coco@...ts.linux.dev>, <kvm@...r.kernel.org>, Dan Williams
	<dan.j.williams@...el.com>, Xin Li <xin@...or.com>, Kai Huang
	<kai.huang@...el.com>, Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [RFC PATCH 2/4] KVM: x86: Extract VMXON and EFER.SVME enablement
 to kernel

>+static void x86_svm_emergency_disable_virtualization_cpu(void)
>+{
>+	virt_rebooting = true;
>+
>+	/*
>+	 * Note, CR4.VMXE can be _cleared_ in NMI context, but it can only be
>+	 * set in task context.  If this races with VMX being disabled via NMI,
>+	 * VMCLEAR and VMXOFF may #UD, but the kernel will eat those faults due
>+	 * to virt_rebooting being set.
>+	 */
>+	if (!(__read_cr4() & X86_CR4_VMXE))
>+		return;

copy-paste error.

>+void __init x86_virt_init(void)
>+{
>+	cpu_emergency_virt_cb *vmx_cb = NULL, *svm_cb = NULL;
>+
>+	if (x86_virt_is_vmx())
>+		vmx_cb = x86_vmx_init();
>+
>+	if (x86_virt_is_svm())
>+		svm_cb = x86_svm_init();
>+
>+	if (!vmx_cb && !svm_cb)
>+		return;
>+
>+	if (WARN_ON_ONCE(vmx_cb && svm_cb))
>+		return;
>+
>+	cpu_emergency_register_virt_callback(vmx_cb ? : svm_cb);

To be consistent with x86_virt_{get,put}_cpu(), perhaps we can have a common
emergency callback and let reboot.c call it directly, with the common callback
routing to svm/vmx code according to the hardware type.

>+	x86_virt_initialized = true;
>+}
>-- 
>2.51.0.740.g6adb054d12-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ