[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXRJ645=08fyeoMQ949fLB1TvhsgERFVx5mAHdViEjq8Q@mail.gmail.com>
Date: Thu, 6 Dec 2018 14:50:01 -0800
From: Andy Lutomirski <luto@...nel.org>
To: "Christopherson, Sean J" <sean.j.christopherson@...el.com>
Cc: Andrew Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
X86 ML <x86@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
LKML <linux-kernel@...r.kernel.org>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Josh Triplett <josh@...htriplett.org>
Subject: Re: [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@...el.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
Powered by blists - more mailing lists