Linux-Sgx Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/sgx: Uncoditionally disallow SGX if MSRs are not writable
@ 2020-01-23 13:07 Jarkko Sakkinen
  2020-01-23 14:34 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Jarkko Sakkinen @ 2020-01-23 13:07 UTC (permalink / raw)
  To: linux-sgx; +Cc: Jarkko Sakkinen, Sean Christopherson, Borislav Petkov

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

Link: https://patchwork.kernel.org/patch/11267757/#23072371
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
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(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 06252c82b8f7..0d57e9666de0 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -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);
 }
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/sgx: Uncoditionally disallow SGX if MSRs are not writable
  2020-01-23 13:07 [PATCH] x86/sgx: Uncoditionally disallow SGX if MSRs are not writable Jarkko Sakkinen
@ 2020-01-23 14:34 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2020-01-23 14:34 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: linux-sgx, Sean Christopherson

On Thu, Jan 23, 2020 at 03:07:46PM +0200, Jarkko Sakkinen wrote:
> As suggested by Borislav, disallow SGX if the PK MSRs are not writable.
> 
> Link: https://patchwork.kernel.org/patch/11267757/#23072371
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Suggested-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
> 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(-)
> 
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index 06252c82b8f7..0d57e9666de0 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -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);
>  }
>  
> -- 

Yap, looks about right.

Thx.

-- 
Regards/Gruss,
    Boris.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 13:07 [PATCH] x86/sgx: Uncoditionally disallow SGX if MSRs are not writable Jarkko Sakkinen
2020-01-23 14:34 ` Borislav Petkov

Linux-Sgx Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-sgx/0 linux-sgx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-sgx linux-sgx/ https://lore.kernel.org/linux-sgx \
		linux-sgx@vger.kernel.org
	public-inbox-index linux-sgx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-sgx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git