sst-linux/arch/x86
Vladis Dronov 34988d2e0c x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
[ Upstream commit 65be5c95d08eedda570a6c888a12384c77fe7614 ]

The kernel requires X86_FEATURE_SGX_LC to be able to create SGX enclaves,
not just X86_FEATURE_SGX.

There is quite a number of hardware which has X86_FEATURE_SGX but not
X86_FEATURE_SGX_LC. A kernel running on such hardware does not create
the /dev/sgx_enclave file and does so silently.

Explicitly warn if X86_FEATURE_SGX_LC is not enabled to properly notify
users that the kernel disabled the SGX driver.

The X86_FEATURE_SGX_LC, a.k.a. SGX Launch Control, is a CPU feature
that enables LE (Launch Enclave) hash MSRs to be writable (with
additional opt-in required in the 'feature control' MSR) when running
enclaves, i.e. using a custom root key rather than the Intel proprietary
key for enclave signing.

I've hit this issue myself and have spent some time researching where
my /dev/sgx_enclave file went on SGX-enabled hardware.

Related links:

  https://github.com/intel/linux-sgx/issues/837
  https://patchwork.kernel.org/project/platform-driver-x86/patch/20180827185507.17087-3-jarkko.sakkinen@linux.intel.com/

[ mingo: Made the error message a bit more verbose, and added other cases
         where the kernel fails to create the /dev/sgx_enclave device node. ]

Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Kai Huang <kai.huang@intel.com>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250309172215.21777-2-vdronov@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:33:39 +02:00
..
boot x86/boot: Use '-std=gnu11' to fix build with GCC 15 2025-02-21 13:49:46 +01:00
coco x86/tdx: Fix "in-kernel MMIO" check 2024-10-17 15:21:29 +02:00
configs
crypto crypto: x86/aegis128 - access 32-bit arguments as 32-bit 2024-12-14 19:53:58 +01:00
entry x86/entry: Fix ORC unwinder for PUSH_REGS with save_ret=1 2025-04-10 14:33:35 +02:00
events perf/x86/intel: Use better start period for frequency mode 2025-03-28 21:58:53 +01:00
hyperv
ia32
include x86/speculation: Add __update_spec_ctrl() helper 2025-03-13 12:53:11 +01:00
kernel x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled 2025-04-10 14:33:39 +02:00
kvm KVM: SVM: Drop DEBUGCTL[5:2] from guest's effective value 2025-03-13 12:53:21 +01:00
lib x86/kmsan: Fix hook for unaligned accesses 2024-09-12 11:10:19 +02:00
math-emu
mm x86/sev: Add missing RIP_REL_REF() invocations during sme_enable() 2025-04-10 14:33:30 +02:00
net bpf, x64: Fix a jit convergence issue 2024-10-17 15:22:13 +02:00
pci PCI: Detect and trust built-in Thunderbolt chips 2024-12-14 19:54:47 +01:00
platform x86/platform/iosf_mbi: Convert PCIBIOS_* return codes to errnos 2024-08-03 08:48:54 +02:00
power
purgatory x86/purgatory: Switch to the position-independent small code model 2024-06-12 11:03:12 +02:00
ras
realmode
tools x86/boot: Ignore relocations in .notes sections in walk_relocs() too 2024-06-12 11:03:07 +02:00
um um: Fix the -Wmissing-prototypes warning for get_thread_reg 2024-06-12 11:03:47 +02:00
video
virt/vmx/tdx
xen Grab mm lock before grabbing pt lock 2025-02-21 13:49:59 +01:00
.gitignore
Kbuild
Kconfig x86/platform: Only allow CONFIG_EISA for 32-bit 2025-04-10 14:33:30 +02:00
Kconfig.assembler
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-23 09:12:43 +01:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-06-12 11:03:50 +02:00
Makefile
Makefile_32.cpu
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-05-01 08:26:27 +09:00