lkml.org 
[lkml]   [2018]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v2 4/4] x86/vdso: Add __vdso_sgx_enter_enclave() to wrap SGX enclave transitions
On Thu, Dec 6, 2018 at 2:19 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
+
> + /*
> + * Invoke the caller's exit handler if one was provided. The return
> + * value tells us whether to re-enter the enclave (EENTER or ERESUME)
> + * or to return (EEXIT).
> + */
> + if (exit_handler) {
> + leaf = exit_handler(exit_info, tcs, priv);
> + if (leaf == SGX_EENTER || leaf == SGX_ERESUME)
> + goto enter_enclave;
> + if (leaf == SGX_EEXIT)
> + return 0;
> + return -EINVAL;
> + } else if (leaf != SGX_EEXIT) {
> + return -EFAULT;
> + }

This still seems overcomplicated to me. How about letting the
requested leaf (EENTER or ERESUME) be a parameter to the function and
then just returning here? As it stands, you're requiring any ERESUME
that gets issued (other than the implicit ones) to be issued in the
same call stack, which is very awkward if you're doing something like
forwarding the fault to a different task over a socket and then
waiting in epoll_wait() or similar before resuming the enclave.

--Andy

\
 
 \ /
  Last update: 2018-12-06 23:50    [W:0.421 / U:2.368 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site