Intel SGX development
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Nathaniel McCallum <npmccallum@redhat.com>,
	Cedric Xing <cedric.xing@intel.com>,
	Jethro Beekman <jethro@fortanix.com>,
	Andy Lutomirski <luto@amacapital.net>,
	linux-sgx@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] x86/vdso: x86/sgx: Introduce dedicated SGX exit reasons for vDSO
Date: Tue, 18 Aug 2020 19:58:38 +0300	[thread overview]
Message-ID: <20200818165838.GC138452@linux.intel.com> (raw)
In-Reply-To: <20200818042405.12871-4-sean.j.christopherson@intel.com>

On Mon, Aug 17, 2020 at 09:24:04PM -0700, Sean Christopherson wrote:
> Use dedicated exit reasons, e.g. SYNCHRONOUS and EXCEPTION, instead of
> '0' and '-EFAULT' respectively.  Using -EFAULT is less than desirable as
> it usually means "bad address", which may or may not be true for a fault
> in the enclave or on ENCLU.
> 
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/entry/vdso/vsgx_enter_enclave.S | 7 +++++--
>  arch/x86/include/uapi/asm/sgx.h          | 3 +++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S
> index aaae6d6e28ac3..b09e87dbe9334 100644
> --- a/arch/x86/entry/vdso/vsgx_enter_enclave.S
> +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S
> @@ -19,6 +19,9 @@
>  /* #define USER_DATA_OFFSET	4*8 */
>  #define EXCEPTION_OFFSET	5*8
>  
> +#define SGX_SYNCHRONOUS_EXIT	0
> +#define SGX_EXCEPTION_EXIT	1
> +
>  /* Offsets into sgx_enter_enclave.exception. */
>  #define EX_TRAPNR	0*8
>  #define EX_ERROR_CODE	0*8+2
> @@ -65,7 +68,7 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
>  	mov	RUN_OFFSET(%rbp), %rbx
>  
>  	/* Set exit_reason. */
> -	movl	$0, EXIT_REASON_OFFSET(%rbx)
> +	movl	$SGX_SYNCHRONOUS_EXIT, EXIT_REASON_OFFSET(%rbx)
>  
>  	/* Invoke userspace's exit handler if one was provided. */
>  .Lhandle_exit:
> @@ -94,7 +97,7 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
>  	mov	RUN_OFFSET(%rbp), %rbx
>  
>  	/* Set the exit_reason and exception info. */
> -	movl	$(-EFAULT), EXIT_REASON_OFFSET(%rbx)
> +	movl	$SGX_EXCEPTION_EXIT, EXIT_REASON_OFFSET(%rbx)
>  
>  	mov	%di,  (EXCEPTION_OFFSET + EX_TRAPNR)(%rbx)
>  	mov	%si,  (EXCEPTION_OFFSET + EX_ERROR_CODE)(%rbx)
> diff --git a/arch/x86/include/uapi/asm/sgx.h b/arch/x86/include/uapi/asm/sgx.h
> index d3b107aac279d..80a8b7a949a23 100644
> --- a/arch/x86/include/uapi/asm/sgx.h
> +++ b/arch/x86/include/uapi/asm/sgx.h
> @@ -74,6 +74,9 @@ struct sgx_enclave_set_attribute {
>  	__u64 attribute_fd;
>  };
>  
> +#define SGX_SYNCHRONOUS_EXIT	0
> +#define SGX_EXCEPTION_EXIT	1

enum would be great here.

> +
>  struct sgx_enclave_run;
>  
>  /**
> -- 
> 2.28.0
> 

/Jarkko

  reply	other threads:[~2020-08-18 16:58 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  4:24 [RFC PATCH 0/4] x86/vdso: x86/sgx: Rework SGX vDSO API Sean Christopherson
2020-08-18  4:24 ` [RFC PATCH 1/4] x86/vdso: x86/sgx: Explicitly force 8-byte CMP for detecting user handler Sean Christopherson
2020-08-18 16:46   ` Jarkko Sakkinen
2020-08-20 11:13   ` Jethro Beekman
2020-08-18  4:24 ` [RFC PATCH 2/4] x86/vdso: x86/sgx: Rework __vdso_sgx_enter_enclave() API Sean Christopherson
2020-08-18 16:57   ` Jarkko Sakkinen
2020-08-20 11:23   ` Jethro Beekman
2020-08-24 13:36   ` Jethro Beekman
2020-08-24 19:49     ` Jarkko Sakkinen
2020-09-04 10:25       ` Sean Christopherson
2020-09-04 13:36         ` Jarkko Sakkinen
2020-09-04 16:01           ` Sean Christopherson
2020-08-24 23:54     ` Sean Christopherson
2020-08-25  7:36       ` Jethro Beekman
2020-08-25  7:38         ` Sean Christopherson
2020-08-25  7:41           ` Jethro Beekman
2020-08-26 20:16             ` Sean Christopherson
2020-08-26 19:27   ` Xing, Cedric
2020-08-26 20:15     ` Sean Christopherson
2020-08-26 23:26       ` Xing, Cedric
2020-09-04  9:52         ` Sean Christopherson
2020-08-27  8:58       ` Jethro Beekman
2020-08-26 20:20   ` Sean Christopherson
2020-08-26 20:55     ` Andy Lutomirski
2020-08-27 13:35     ` Jarkko Sakkinen
2020-08-18  4:24 ` [RFC PATCH 3/4] x86/vdso: x86/sgx: Introduce dedicated SGX exit reasons for vDSO Sean Christopherson
2020-08-18 16:58   ` Jarkko Sakkinen [this message]
2020-08-20 11:13   ` Jethro Beekman
2020-08-18  4:24 ` [RFC PATCH 4/4] x86/vdso: x86/sgx: Allow the user to exit the vDSO loop on interrupts Sean Christopherson
2020-08-18 17:00   ` Jarkko Sakkinen
2020-08-18 17:15   ` Andy Lutomirski
2020-08-18 17:31     ` Sean Christopherson
2020-08-18 19:05       ` Andy Lutomirski
2020-08-19 14:21     ` Jethro Beekman
2020-08-19 15:02       ` Andy Lutomirski
2020-08-20 11:20         ` Jethro Beekman
2020-08-20 17:44           ` Andy Lutomirski
2020-08-20 17:53             ` Jethro Beekman
2020-08-22 21:55               ` Andy Lutomirski
2020-08-24 13:36                 ` Jethro Beekman
2020-08-26 18:32                   ` Sean Christopherson
2020-08-26 19:09                     ` Xing, Cedric
2020-08-27  8:57                     ` Jethro Beekman
2020-08-20 11:13   ` Jethro Beekman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818165838.GC138452@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=cedric.xing@intel.com \
    --cc=jethro@fortanix.com \
    --cc=linux-sgx@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=npmccallum@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox