Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp752326imu; Tue, 11 Dec 2018 07:04:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/U75LECgZCFcyHwNqZjiG0zBd98+O0RBoLVEc51Yjn+RomRrXk7BxoYbh6m07/n1yNiZx8f X-Received: by 2002:a63:4044:: with SMTP id n65mr14444090pga.90.1544540692997; Tue, 11 Dec 2018 07:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544540692; cv=none; d=google.com; s=arc-20160816; b=FGG8vz96+NPMARwqVvwrjKrC5JpAJn13tasnFJZiLXX2VAI/Ukc53VvRZzxJdoXVMq laILjQftToCSEmRaODD61JIQ5e+PszdOcjuEDBtFFkR8Kqy9JDhgnPDrI0/NdSuGcWC0 langkWgnSr7F+bJNAbAUEeWRFAeDcWBGFJFnq8+uN8D+gQM4Dastc2XtItQgA4wk86s2 O2qHwSkaUg1qZCbTXepvPGcQgiAjvy1ThlYwZM4ItQIWV2u4Ri8bJsBn5Ui8yf52rlnK kGWhydknPJ9FxPjQ/+04cT/1OhBRgHQugWLTOftaXZjQ9bby1m4giASRU7ZRRDuRi5sL j/ww== 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=jp5DKkCm9udh2cflGGWQjqY+4Hxfgdf9PA0OqiR4yUA=; b=mRMEDjdqW7vwnv88q+gz+zrO348RViRotoX+aFkFgLCjvOYtbcX0cYACS7kxKugKcw sGS5IzshufJJucVXHsle1hOn1tvX3wzD8o+uQGK+Jc0iV3n67UzZTS2MtsaQgKNO6u3G liUx1TR+G0bOEgl6Ulh9i6EZklRCWXJJwdR1+JtWDjLxlYfBv/td3cRYP1j6FBuePm9L lL/kwkkDOrm6P9ogFYA50zlfubyK/hx7u9p2F2g6YYjWDBWx1USOr2oaCQF9lmRCNFsR PeG98bn1YdXe/GVBG0O2tMCSuTCkGvVfJ750Cxk+uefgdfewl9w1jC9fKzbsFJYaioeZ zeyQ== 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 187si13130127pfv.238.2018.12.11.07.04.35; Tue, 11 Dec 2018 07:04:52 -0800 (PST) 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 S1726452AbeLKPBx (ORCPT + 99 others); Tue, 11 Dec 2018 10:01:53 -0500 Received: from mga06.intel.com ([134.134.136.31]:52613 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbeLKPBx (ORCPT ); Tue, 11 Dec 2018 10:01:53 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 07:01:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,342,1539673200"; d="scan'208";a="100651266" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by orsmga008.jf.intel.com with ESMTP; 11 Dec 2018 07:01:52 -0800 Date: Tue, 11 Dec 2018 07:01:52 -0800 From: Sean Christopherson To: "Dr. Greg" Cc: Josh Triplett , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Jarkko Sakkinen , Dave Hansen , Andy Lutomirski , Peter Zijlstra , "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, Andy Lutomirski , Haitao Huang , Jethro Beekman Subject: Re: [RFC PATCH v3 0/4] x86: Add exception fixup for SGX ENCLU Message-ID: <20181211150152.GA14731@linux.intel.com> References: <20181210232141.5425-1-sean.j.christopherson@intel.com> <20181210232449.GA11843@localhost> <20181211145339.GA7528@wind.enjellic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181211145339.GA7528@wind.enjellic.com> 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 Tue, Dec 11, 2018 at 08:53:39AM -0600, Dr. Greg wrote: > On Mon, Dec 10, 2018 at 03:24:50PM -0800, Josh Triplett wrote: > > Good morning to everyone, I hope the week is progressing well. > > > On Mon, Dec 10, 2018 at 03:21:37PM -0800, Sean Christopherson wrote: > > > At that point I realized it's a hell of a lot easier to simply provide > > > an IOCTL via /dev/sgx that allows userspace to register a per-process > > > ENCLU exception handler. At a high level, the basic idea is the same > > > as the vDSO approach: provide a hardcoded fixup handler for ENCLU and > > > attempt to fixup select unhandled exceptions that occurred in user code. > > > So, on the one hand, this is *absolutely* much cleaner than the VDSO > > approach. On the other hand, this is global process state and has > > some of the same problems as a signal handler as a result. > > Sean's architecture is very simple and straight forward and thus has a > lot going for it. > > As Sean's approach indicates, by linking the exception handler to > current->mm, SGX is very much a per memory map concept. The issue is > that there can be multiple enclaves loaded and excecuting in a > processes memory map, the problem is, execution and thus exception > handling, is very much at the per thread level. Right, but is there a need to have a per-thread code page? The handler isn't per-process any more than the AEP is per-process.