Commit 4d872d51 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86-urgent-2025-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

 - Fix out-of-bounds access on CPU-less AMD NUMA systems by the
   microcode code

 - Make the kernel SGX CPU init code less passive-aggressive about
   non-working SGX features, instead of silently keeping the driver
   disabled, this is something people are running into. This doesn't
   affect functionality, it's a sysadmin QoL fix

* tag 'x86-urgent-2025-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/microcode/AMD: Fix out-of-bounds on systems with CPU-less NUMA nodes
  x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
parents 80e54e84 e3e89178
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1074,7 +1074,7 @@ static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t siz
	if (ret != UCODE_OK)
		return ret;

	for_each_node(nid) {
	for_each_node_with_cpus(nid) {
		cpu = cpumask_first(cpumask_of_node(nid));
		c = &cpu_data(cpu);

+7 −3
Original line number Diff line number Diff line
@@ -150,13 +150,15 @@ int __init sgx_drv_init(void)
	u64 xfrm_mask;
	int ret;

	if (!cpu_feature_enabled(X86_FEATURE_SGX_LC))
	if (!cpu_feature_enabled(X86_FEATURE_SGX_LC)) {
		pr_info("SGX disabled: SGX launch control CPU feature is not available, /dev/sgx_enclave disabled.\n");
		return -ENODEV;
	}

	cpuid_count(SGX_CPUID, 0, &eax, &ebx, &ecx, &edx);

	if (!(eax & 1))  {
		pr_err("SGX disabled: SGX1 instruction support not available.\n");
		pr_info("SGX disabled: SGX1 instruction support not available, /dev/sgx_enclave disabled.\n");
		return -ENODEV;
	}

@@ -173,8 +175,10 @@ int __init sgx_drv_init(void)
	}

	ret = misc_register(&sgx_dev_enclave);
	if (ret)
	if (ret) {
		pr_info("SGX disabled: Unable to register the /dev/sgx_enclave driver (%d).\n", ret);
		return ret;
	}

	return 0;
}