lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Dec 2018 05:55:47 -0800
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Andy Lutomirski <luto@...nel.org>
Cc:     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 4/4] x86/vdso: Add __vdso_sgx_eenter() to wrap SGX
 enclave transitions

On Wed, Dec 05, 2018 at 03:40:48PM -0800, Andy Lutomirski wrote:
> On Wed, Dec 5, 2018 at 3:20 PM Sean Christopherson
> <sean.j.christopherson@...el.com> wrote:
> > +notrace long __vdso_sgx_eenter(void *tcs, void *priv,
> > +                              struct sgx_eenter_fault_info *fault_info)
> > +{
> > +       u32 trapnr, error_code;
> > +       long leaf;
> > +       u64 addr;
> > +
> > +       /*
> > +        *      %eax = EENTER
> > +        *      %rbx = tcs
> > +        *      %rcx = do_eresume
> > +        *      %rdi = priv
> > +        * do_eenter:
> > +        *      enclu
> > +        *      jmp     out
> > +        *
> > +        * do_eresume:
> > +        *      enclu
> > +        *      ud2
> 
> Is the only reason for do_eresume to be different from do_eenter so
> that you can do the ud2?

No, it was a holdover from doing fixup via a magic prefix in user code.
The fixup could only skip the ENCLU and so a second ENCLU was needed to
differentiate between EENTER and ERESUME.  The need for two ENCLUs got
ingrained in my head.  I can't think of anything that will break if we
use a single ENCLU.

> > +        *
> > +        * out:
> > +        *      <return to C code>
> > +        *
> > +        * fault_fixup:
> > +        *      <extable loads RDI, DSI and RDX with fault info>
> > +        *      jmp     out
> > +        */
> 
> This has the IMO excellent property that it's extremely awkward to use
> it for a model where the enclave is reentrant.  I think it's excellent
> because reentrancy on the same enclave thread is just asking for
> severe bugs.  Of course, I fully expect the SDK to emulate reentrancy,
> but then it's 100% their problem :)  On the fiip side, it means that
> you can't really recover from a reported fault, even if you want to,
> because there's no way to ask for ERESUME.  So maybe the API should
> allow that after all.

Doh.  The ability to do ERESUME is an explicit requirement from the SDK
folks.  More code that I pulled from my userspace implementation and
didn't revisit.

> I think it might be polite to at least give some out regs, maybe RSI and RDI?

For the outbound path?  I was thinking @priv would be used for passing
data out as well as in.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ