Skip to contentSkip to conversation

x86/sgx: Uncoditionally disallow SGX if MSRs are not writable

PATCH In review Jarkko Sakkinen 2 participants 2 messages Jan 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sgx: Uncoditionally disallow SGX if MSRs are not writable

As suggested by Borislav, disallow SGX if the PK MSRs are not writable.

---
Just a sanity check before merge, please ack that this is what you wanted.

 arch/x86/kernel/cpu/intel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/cpu/intel.c +1 -3
index 06252c82b8f7..0d57e9666de0 100644
@@ -600,7 +600,7 @@ static void __maybe_unused detect_sgx(struct cpuinfo_x86 *c)
 
 	if (!(fc & FEATURE_CONTROL_SGX_LE_WR)) {
 		pr_info_once("sgx: The launch control MSRs are not writable\n");
-		goto err_msrs_rdonly;
+		goto err_unsupported;
 	}
 
 	return;
@@ -609,8 +609,6 @@ static void __maybe_unused detect_sgx(struct cpuinfo_x86 *c)
 	setup_clear_cpu_cap(X86_FEATURE_SGX);
 	setup_clear_cpu_cap(X86_FEATURE_SGX1);
 	setup_clear_cpu_cap(X86_FEATURE_SGX2);
-
-err_msrs_rdonly:
 	setup_clear_cpu_cap(X86_FEATURE_SGX_LC);
 }
 
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 27 lines · Jarkko Sakkinen

As suggested by Borislav, disallow SGX if the PK MSRs are not writable.

---
Just a sanity check before merge, please ack that this is what you wanted.

 arch/x86/kernel/cpu/intel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/cpu/intel.c +1 -1
index 06252c82b8f7..0d57e9666de0 100644
@@ -600,7 +600,7 @@ static void __maybe_unused detect_sgx(struct cpuinfo_x86 *c)
 
 	if (!(fc & FEATURE_CONTROL_SGX_LE_WR)) {
 		pr_info_once("sgx: The launch control MSRs are not writable\n");
-		goto err_msrs_rdonly;
+		goto err_unsupported;
 	}
 
 	return;

arch/x86/kernel/cpu/intel.c static void __maybe_unused detect_sgx(struct cpuinfo_x86 *c) · line 614

Quoted 8 lines
arch/x86/kernel/cpu/intel.c +0 -2
@@ -609,8 +609,6 @@ static void __maybe_unused detect_sgx(struct cpuinfo_x86 *c)
 	setup_clear_cpu_cap(X86_FEATURE_SGX);
 	setup_clear_cpu_cap(X86_FEATURE_SGX1);
 	setup_clear_cpu_cap(X86_FEATURE_SGX2);
-
-err_msrs_rdonly:
 	setup_clear_cpu_cap(X86_FEATURE_SGX_LC);
 }
 

Yap, looks about right.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette