2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/arch/x86/kernel/cpu/sgx
Vladis Dronov 65be5c95d0 x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
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
2025-03-10 12:29:18 +01:00
..
driver.c x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled 2025-03-10 12:29:18 +01:00
driver.h x86/sgx: Add SGX_IOC_ENCLAVE_PROVISION 2020-11-18 18:02:50 +01:00
encl.c x86/sgx: Resolves SECS reclaim vs. page fault for EAUG race 2023-09-28 16:16:40 -07:00
encl.h x86/sgx: Improve comments for sgx_encl_lookup/alloc_backing() 2022-08-15 11:51:49 +02:00
encls.h x86/sgx: Add wrapper for SGX2 EAUG function 2022-07-07 10:13:01 -07:00
ioctl.c x86/sgx: Fix size overflows in sgx_encl_create() 2025-03-05 09:51:41 +01:00
main.c - Use vmalloc_array() instead of vmalloc() 2024-11-22 12:50:00 -08:00
Makefile x86/sgx: Introduce virtual EPC for use by KVM guests 2021-04-06 09:43:17 +02:00
sgx.h docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
virt.c x86/sgx: Break up long non-preemptible delays in sgx_vepc_release() 2023-09-06 23:55:09 +02:00