[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181102170627.GD7393@linux.intel.com>
Date: Fri, 2 Nov 2018 10:06:28 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Rich Felker <dalias@...c.org>, Jann Horn <jannh@...gle.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Jethro Beekman <jethro@...tanix.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Florian Weimer <fweimer@...hat.com>,
Linux API <linux-api@...r.kernel.org>, X86 ML <x86@...nel.org>,
linux-arch <linux-arch@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>, nhorman@...hat.com,
npmccallum@...hat.com, "Ayoun, Serge" <serge.ayoun@...el.com>,
shay.katz-zamir@...el.com, linux-sgx@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Carlos O'Donell <carlos@...hat.com>,
adhemerval.zanella@...aro.org
Subject: Re: RFC: userspace exception fixups
On Fri, Nov 02, 2018 at 09:56:44AM -0700, Dave Hansen wrote:
> On 11/2/18 9:30 AM, Sean Christopherson wrote:
> > What if rather than having userspace register an address for fixup, the
> > kernel instead unconditionally does fixup on the ENCLU opcode?
>
> The problem is knowing what to do for the fixup. If we have a simple
> action to take that's universal, like backing up %RIP, or setting some
> other register state, it's not bad.
Isn't the EENTER/RESUME behavior universal? Or am I missing something?
> Think of our prefetch fixups in the page fault code. We do some
> instruction decoding to look for them, and then largely return from the
> fault and let the CPU retry. We know *exactly* what to do for these.
>
> But, if we need to call arbitrary code, or switch stacks, we need an
> explicit ABI around it *anyway*, because the action to take isn't clear.
>
> For an enclave exit that's because of a hardware interrupt or page
> fault, life is good. We really *could* just set %RIP to let ERESUME run
> again, kinda like we do for (some) syscall situations. But the
> situations for which we can't just call ERESUME, like the out-calls make
> this more challenging. I think we'd need some explicit new interfaces
> for those.
I don't see how out-calls are a problem. Once EEXIT completes we're
no longer in the enclave and EPCM faults are no longer a concern, i.e.
we don't need to do fixup. Every other enclave exit is either an
exception or an interrupt. And the only way to get back into the
enclave is via ENCLU (EENTER or ERESUME).
Powered by blists - more mailing lists