From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: RFC: userspace exception fixups Date: Mon, 26 Nov 2018 14:06:27 -0800 Message-ID: <20181126220627.GD868@linux.intel.com> References: <20181118071548.GA4795@linux.intel.com> <20181119160204.GD13298@linux.intel.com> <20181120101133.GA7319@linux.intel.com> <20181120225518.GE8391@linux.intel.com> <0a78772e-4f42-254b-d91a-f0f80a24ff90@fortanix.com> <20181121151734.GA16564@linux.intel.com> <20181126143534.GA25719@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20181126143534.GA25719@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Sean Christopherson Cc: Jethro Beekman , Andy Lutomirski , Dave Hansen , Florian Weimer , Linux API , Jann Horn , Linus Torvalds , X86 ML , linux-arch , LKML , Peter Zijlstra , Rich Felker , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "shay.katz-zamir@intel.com" , "linux-sgx@vger.kernel.org" , Andy Shevchenko , Thomas List-Id: linux-arch.vger.kernel.org On Mon, Nov 26, 2018 at 06:35:34AM -0800, Sean Christopherson wrote: > And how would you determine the #UD is related to SGX? Hardware doesn't > provide any indication that a #UD (or any other fault) is related to SGX > or occurred in an enclave. The only fault that is special-cased in a > non-virtualized environment is #PF signaled by the EPCM, which gets the > PF_SGX bit set in the error code. Could you not detect #UD from address where it happened? Kernel knows where enclaves are mapped. BTW, how does Intel run-time emulate opcodes currently? Anyway, I've fully discarded the whole idea because implementing single stepping w/o well defined AEP handler is nasty. I think vDSO's are the only viable path that at least I'm aware off... /Jarkko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com ([192.55.52.120]:60344 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbeK0JCC (ORCPT ); Tue, 27 Nov 2018 04:02:02 -0500 Date: Mon, 26 Nov 2018 14:06:27 -0800 From: Jarkko Sakkinen Subject: Re: RFC: userspace exception fixups Message-ID: <20181126220627.GD868@linux.intel.com> References: <20181118071548.GA4795@linux.intel.com> <20181119160204.GD13298@linux.intel.com> <20181120101133.GA7319@linux.intel.com> <20181120225518.GE8391@linux.intel.com> <0a78772e-4f42-254b-d91a-f0f80a24ff90@fortanix.com> <20181121151734.GA16564@linux.intel.com> <20181126143534.GA25719@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126143534.GA25719@linux.intel.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Sean Christopherson Cc: Jethro Beekman , Andy Lutomirski , Dave Hansen , Florian Weimer , Linux API , Jann Horn , Linus Torvalds , X86 ML , linux-arch , LKML , Peter Zijlstra , Rich Felker , "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 Message-ID: <20181126220627.pizpCbcgF9N-UMTORw9pbv-rxQPP4Nhcfs3QQibSUN0@z> On Mon, Nov 26, 2018 at 06:35:34AM -0800, Sean Christopherson wrote: > And how would you determine the #UD is related to SGX? Hardware doesn't > provide any indication that a #UD (or any other fault) is related to SGX > or occurred in an enclave. The only fault that is special-cased in a > non-virtualized environment is #PF signaled by the EPCM, which gets the > PF_SGX bit set in the error code. Could you not detect #UD from address where it happened? Kernel knows where enclaves are mapped. BTW, how does Intel run-time emulate opcodes currently? Anyway, I've fully discarded the whole idea because implementing single stepping w/o well defined AEP handler is nasty. I think vDSO's are the only viable path that at least I'm aware off... /Jarkko