Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2373672imd; Fri, 2 Nov 2018 10:14:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5dGjN8fi6NqwYPxYNcXNQeCoxzp+yL7WX1P+Tqckyf3l7wwNS/MWrZNkeYF123v5fA/C1iK X-Received: by 2002:a17:902:9b95:: with SMTP id y21-v6mr10562316plp.179.1541178841132; Fri, 02 Nov 2018 10:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541178841; cv=none; d=google.com; s=arc-20160816; b=kDJJp60cABq75n7+CvSFDgR+Ni9crVYdyetqZnDdxUomjBzgD/KqxI8WguNqNhgvQR ivS4u3qBoO4UYujpGt3yN01hZ8aR6/Cck7eGuzQ608e6R3hKAkvrmJdZOxs8WInlacH3 kZr9UBHZ4ort02KWrNJgS8eP7XTwLOsnEqxvZu5x12c0obR4xXXfrJQi/8GzRvNO7OVT 6PKhbwR2Rw384/R9pA0cFKFBLbacqy7UTNtDtj0tQJ0AklSjtnHWBZKpip44q4ZzK0H9 5ih6Ct7wsOtGjqRg9Xby2XELj+pSsqmeDXFqqh0TxhGv5OAJ6Tb5gPtihdCIT7Eh4vlH u0Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Y5G+VF9Rxz48vG/tgVQ2uWWgAPjc/pqBw9iYTa/KceI=; b=Rkl3y4eHSd9v5XXAR8stVw+SZRwqDLkIq+CrU9uPWyYtA4m/Hg8tMI4qct51bC7OOq z+4y6DJ8itrZtgkVXCuLHIeCv56hUXhDOKuReYwbUs99xaH9dj3v/aDg4hX9EDVxIRUu 7y+Nv2YeUASp/efISJqhP7FGlt2xZtyNOXj0jwlbzdHhDld4aV5ZUmsxwqt0Nwugoz0o FlGRUe8BCwZhogGnj5lcqHj4CGn0mgJiPzNk/hn+X7SVfwFCRcPF0mBKB3zqQnWatrRi 1BUvyUkjqDUn1uxKIOpkYn1dHcLgXfYFUgJJz4uwKov7eOCu8xq4wD7NCjkhgfHf8EHJ Ff/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e133-v6si34790820pfh.289.2018.11.02.10.13.45; Fri, 02 Nov 2018 10:14:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbeKCCUn (ORCPT + 99 others); Fri, 2 Nov 2018 22:20:43 -0400 Received: from mga09.intel.com ([134.134.136.24]:6058 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbeKCCUn (ORCPT ); Fri, 2 Nov 2018 22:20:43 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2018 10:12:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,456,1534834800"; d="scan'208";a="102932764" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.193]) by fmsmga004.fm.intel.com with ESMTP; 02 Nov 2018 10:12:51 -0700 Date: Fri, 2 Nov 2018 10:12:51 -0700 From: Sean Christopherson To: Jethro Beekman Cc: Andy Lutomirski , Linus Torvalds , Rich Felker , Jann Horn , Dave Hansen , Jarkko Sakkinen , 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" Subject: Re: RFC: userspace exception fixups Message-ID: <20181102171251.GE7393@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: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 04:56:36PM +0000, Jethro Beekman wrote: > On 2018-11-02 09:52, 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. > > > > Various reasons... > > Userspace may have established an exception handling convention with the > enclave (by setting TCS.NSSA > 1) and may want to call EENTER instead of > ERESUME. The ERESUME trampoline would only be invoked for exceptions that aren't transferred to userspace. On #BR, #UD, etc..., the kernel would fixup %RIP to effectively point at @fault_handler. Userspace can then do whatever it wants to handle the fault, e.g. do EENTER if the fault needs to be serviced by the enclave. > Userspace may want fine-grained control over enclave scheduling (e.g. > SGX-Step) Uh, isn't SGX-Step an attack on SGX? Preventing userspace from playing games with enclave scheduling seems like a good thing.