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 2/4] x86/vdso: x86/sgx: Rework __vdso_sgx_enter_enclave() API
Date: Tue, 18 Aug 2020 19:57:45 +0300 [thread overview]
Message-ID: <20200818165745.GB138452@linux.intel.com> (raw)
In-Reply-To: <20200818042405.12871-3-sean.j.christopherson@intel.com>
On Mon, Aug 17, 2020 at 09:24:03PM -0700, Sean Christopherson wrote:
> Rework __vdso_sgx_enter_enclave() to use a struct to hold the input and
> output params. In the new struct, add an opaque "user_data" that can be
> used to pass context across the vDSO, and an explicit "exit_reason" to
> avoid overloading the return value.
>
> Moving the params into a struct will also make it less painful to use
> dedicated exit reasons, and to support exiting on interrupts in future
> patches.
>
> Cc: Nathaniel McCallum <npmccallum@redhat.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/x86/entry/vdso/vsgx_enter_enclave.S | 72 ++++++++++++-------
> arch/x86/include/uapi/asm/sgx.h | 90 ++++++++++++++++--------
> 2 files changed, 107 insertions(+), 55 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S
> index 2d88acd408d4e..aaae6d6e28ac3 100644
> --- a/arch/x86/entry/vdso/vsgx_enter_enclave.S
> +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S
> @@ -7,9 +7,21 @@
>
> #include "extable.h"
>
> -#define EX_LEAF 0*8
> -#define EX_TRAPNR 0*8+4
> -#define EX_ERROR_CODE 0*8+6
> +/* Offset of 'struct sgx_enter_enclave' relative to %rbp. */
> +#define RUN_OFFSET 2*8
Some better name please.
> +
> +/* Offsets into 'struct sgx_enter_enclave'. */
> +#define TCS_OFFEST 0*8
> +#define FLAGS_OFFSET 1*8
> +#define EXIT_LEAF_OFFSET 2*8
> +#define EXIT_REASON_OFFSET 2*8 + 4
> +#define USER_HANDLER_OFFSET 3*8
> +/* #define USER_DATA_OFFSET 4*8 */
> +#define EXCEPTION_OFFSET 5*8
These non-prefixed constants make the code really stressing to read
given the complexity of it. Please, just write them like
SGX_ENTER_ENCLAVE_TCS and so forth.
/Jarkko
next prev parent reply other threads:[~2020-08-18 16:59 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 [this message]
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
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=20200818165745.GB138452@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.