Two x86 fixes:

- 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.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmfPQ8gRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1jVRQ/+PhQNRKBl9eWVxrsPfLugxU1EgFbaO5lj
 TWM1NcUq7BJnHZOo/o1DvBgLkh4QXf3SBGa3iBSIvanfSvBWMuPxtCVTYrc3Iubg
 VrUTrQhUcXeUe91f6tx+36E1ZmkYSSUYXS97TXKGM3pgZ7VGUQ6ZKBu5VhX4tWGU
 q1V2cLEUGI/Z006mEbCAsVFf0i5qvcg/8bZL6o7dC5rjp6C3nSK4cwqTmngDT0Gv
 ujmzH3Mx31fO1SMLlPRFBODlz23cPt3nTLKiK8ZrqVcAotSmxb+xYj3zcTMYE3DE
 Grnfe8B+d2QR1hBEdyoM7/VEWFQJz5WSpiY3hVGM2wV6J82JtQ8h9x10Zwj3kWzI
 nX6DX7EdoxORAWZsZ6poNf45KQ1CzfejMCqbC4zGn+HeTHket9ykhxz+4T4Y9u6K
 cVuzqqLkzoMSE6PPySmThM6jVoEnRWWhjmK+zkH2CuFzOybj8denZaFW9LUbRbxX
 ZlFhGFhLYx/OdKjM9nV9Hz18vTHx8nwPMSoExLQ+qAWIK89DP6U3aaoZZaaWZrew
 V9NAbmUwWGBat62dHZrfOVO9cnjm6oLekesi/TU5AYqhZi/8aR6V7EmAKEb3qTGL
 XFRQVIYqnm8ybhcBq1OzfT9Uy3vyMv2F/5INfWk3tOAVlTQlLtP1rCGXvgsLgbwP
 yOhob4QPJM8=
 =rvJV
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-03-10 10:14:56 -10:00
commit 4d872d51bc
2 changed files with 8 additions and 4 deletions

View File

@ -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);

View File

@ -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;
}