linux/arch
Vladis Dronov 3c9a43eef0 x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
[ Upstream commit 65be5c95d0 ]

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>
History 2025-04-10 14:32:03 +02:00
..
alpha alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support 2025-04-10 14:31:50 +02:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:28:49 +01:00
arm ARM: Remove address checking for MMUless devices 2025-04-10 14:31:56 +02:00
arm64 arm64: dts: rockchip: fix u2phy1_host status for NanoPi R4S 2025-04-10 14:31:55 +02:00
csky csky, hexagon: fix broken sys_sync_file_range 2024-07-05 09:14:48 +02:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:27:21 +01:00
hexagon hexagon: Fix unbalanced spinlock in die() 2025-03-13 12:50:14 +01:00
ia64 arch: Introduce CONFIG_FUNCTION_ALIGNMENT 2024-04-10 16:18:49 +02:00
m68k m68k: vga: Fix I/O defines 2025-03-13 12:50:23 +01:00
microblaze microblaze: don't treat zero reserved memory regions as error 2024-10-17 15:10:38 +02:00
mips MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static 2025-03-13 12:50:33 +01:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:59:14 +02:00
openrisc openrisc: Call setup_memory() earlier in the init sequence 2024-09-04 13:23:27 +02:00
parisc Revert "parisc: fix a possible DMA corruption" 2024-12-19 18:07:22 +01:00
powerpc powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM_ALLOC 2025-03-13 12:50:52 +01:00
riscv riscv: Fix sleeping in invalid context in die() 2025-01-23 17:15:52 +01:00
s390 s390/traps: Fix test_monitor_call() inline assembly 2025-03-13 12:51:03 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-14 19:51:16 +01:00
sparc sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-19 05:45:04 +02:00
um um: Always dump trace for specified task in show_stack 2024-12-14 19:51:19 +01:00
x86 x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled 2025-04-10 14:32:03 +02:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-06 13:18:14 +02:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:24:48 +02:00