From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: RFC: userspace exception fixups Date: Sat, 3 Nov 2018 00:42:04 +0200 Message-ID: <20181102224204.GC24373@linux.intel.com> References: <20181101185225.GC5150@brightrain.aerifal.cx> <20181101193107.GE5150@brightrain.aerifal.cx> <20181102163034.GB7393@linux.intel.com> <7e14ee0e-ce15-1e88-7ae9-4d0f40cb3d84@fortanix.com> <20181102165204.GC7393@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20181102165204.GC7393@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Sean Christopherson Cc: Jethro Beekman , Andy Lutomirski , Linus Torvalds , Rich Felker , Jann Horn , Dave Hansen , Florian Weimer , Linux API , X86 ML , linux-arch , LKML , Peter Zijlstra , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "shay.katz-zamir@intel.com" , "linux-sgx@vger.kernel.org" , Andy Shevchenko , Thomas Gleixner List-Id: linux-arch.vger.kernel.org On Fri, Nov 02, 2018 at 09:52:04AM -0700, Sean Christopherson wrote: > On Fri, Nov 02, 2018 at 04:37:10PM +0000, Jethro Beekman wrote: > > On 2018-11-02 09:30, Sean Christopherson wrote: > > >... The intended convention for EENTER is to have an ENCLU at the AEX target ... > > > > > >... to further enforce that the AEX target needs to be ENCLU. > > > > Some SGX runtimes may want to use a different AEX target. > > To what end? Userspace gets no indication as to why the AEX occurred. > And if exceptions are getting transfered to userspace the trampoline > would effectively be handling only INTR, NMI, #MC and EPC #PF. I've understood that in some cases run-time implementation requires to run a handler implemented inside the enclave i.e the sequence would be 1. #AEX 2. EENTER(in-enclave handler) 3. EEXIT(%rcx) 4. ERESUME /Jarkko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com ([192.55.52.43]:50503 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbeKCHvR (ORCPT ); Sat, 3 Nov 2018 03:51:17 -0400 Date: Sat, 3 Nov 2018 00:42:04 +0200 From: Jarkko Sakkinen Subject: Re: RFC: userspace exception fixups Message-ID: <20181102224204.GC24373@linux.intel.com> References: <20181101185225.GC5150@brightrain.aerifal.cx> <20181101193107.GE5150@brightrain.aerifal.cx> <20181102163034.GB7393@linux.intel.com> <7e14ee0e-ce15-1e88-7ae9-4d0f40cb3d84@fortanix.com> <20181102165204.GC7393@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181102165204.GC7393@linux.intel.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Sean Christopherson Cc: Jethro Beekman , Andy Lutomirski , Linus Torvalds , Rich Felker , Jann Horn , Dave Hansen , Florian Weimer , Linux API , X86 ML , linux-arch , LKML , Peter Zijlstra , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "shay.katz-zamir@intel.com" , "linux-sgx@vger.kernel.org" , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Carlos O'Donell , "adhemerval.zanella@linaro.org" Message-ID: <20181102224204.0lKtLWXL8kMQth2NSdwiYhCHEnjfQNTjWg3RudQecOo@z> On Fri, Nov 02, 2018 at 09:52:04AM -0700, Sean Christopherson wrote: > On Fri, Nov 02, 2018 at 04:37:10PM +0000, Jethro Beekman wrote: > > On 2018-11-02 09:30, Sean Christopherson wrote: > > >... The intended convention for EENTER is to have an ENCLU at the AEX target ... > > > > > >... to further enforce that the AEX target needs to be ENCLU. > > > > Some SGX runtimes may want to use a different AEX target. > > To what end? Userspace gets no indication as to why the AEX occurred. > And if exceptions are getting transfered to userspace the trampoline > would effectively be handling only INTR, NMI, #MC and EPC #PF. I've understood that in some cases run-time implementation requires to run a handler implemented inside the enclave i.e the sequence would be 1. #AEX 2. EENTER(in-enclave handler) 3. EEXIT(%rcx) 4. ERESUME /Jarkko