Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1082822ybm; Tue, 21 May 2019 08:22:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqztgH79mnYX7XsZ+YMZT3IN+ARh1YbNaFZgPLHcq8cZEZfyyehiYg7tArncDC+VmtYPi3e6 X-Received: by 2002:a62:ac0c:: with SMTP id v12mr5624488pfe.59.1558452160223; Tue, 21 May 2019 08:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558452160; cv=none; d=google.com; s=arc-20160816; b=ubgxsMxsKP1pHuHLOASApXcL8G4+vBlgiyZm/cAo0VK+nUOfost/Kb/kyNkt0+lQvA dCQaHodzLzmjWF7gkRuy1yyMgkmTLWDby+e04yTJ1WQlhf+xNFE/NtDBkRz9BNvkal3H CN3qAIom8iNh2uyNOFJDBW3wrQkgBWlBaek5jNRWCySQOWCp+x7JpDRmw21wJ2w7O/Tz 0wG2JVXP2cPZVZHD4PH7JkMW2/vYRzFuXMa99mLh7LNl3/DMoM7Ak4sX9WpESnvMr9QG rekV3h93V6hj6aaXX3FuJ0TnyVaVUV4Lxh+WZ3eATcd1jzUu7BtdynnNpWb8MQSxWE/z UUkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VHnofs07LRGLnOu1/Hh4rPBNDlnOXn9T2ufIOdWPhF4=; b=EX6+VwoNvPGBnYOvzZylXOWR34i4ymmBRZahcCrxyWVM0hM1PFbj461AXDDYPKTrAV sQyt5aXT0OlriQ3ZzgyCBNWKjFN+MgBbd4RZCKapcvyolZ1sIl5vewXEJNunMWqgj3Kx /upXlHVqJrRh22ZF4ruZE8pcsPaDwGjH4ihBHi1oMbhKT62mzIx6zGhBigfgAFcKUuSW goP5J19WdHP7AowKioZCMubldXmxlvhG+PkbYJ93GmY/V1EnsJxTSnapQQ2jtLdralVq OuE63gwzw0bWyw0NNek5eS3Kv9U5ADP+ejw8GQimNtRFpRkkycBcNMiDKeDsY/fn/4a9 j5Gg== 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 v189si8454632pgd.60.2019.05.21.08.22.23; Tue, 21 May 2019 08:22:40 -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 S1728711AbfEUPTy (ORCPT + 99 others); Tue, 21 May 2019 11:19:54 -0400 Received: from mga04.intel.com ([192.55.52.120]:23051 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727534AbfEUPTy (ORCPT ); Tue, 21 May 2019 11:19:54 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 08:19:53 -0700 X-ExtLoop1: 1 Received: from hupe-mobl.ger.corp.intel.com (HELO localhost) ([10.252.46.220]) by orsmga002.jf.intel.com with ESMTP; 21 May 2019 08:19:38 -0700 Date: Tue, 21 May 2019 18:19:37 +0300 From: Jarkko Sakkinen To: Andy Lutomirski Cc: Sean Christopherson , James Morris , "Serge E. Hallyn" , LSM List , Paul Moore , Stephen Smalley , Eric Paris , selinux@vger.kernel.org, Jethro Beekman , "Xing, Cedric" , "Hansen, Dave" , Thomas Gleixner , "Dr. Greg" , Linus Torvalds , LKML , X86 ML , "linux-sgx@vger.kernel.org" , Andrew Morton , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "Katz-zamir, Shay" , "Huang, Haitao" , Andy Shevchenko , "Svahn, Kai" , Borislav Petkov , Josh Triplett , "Huang, Kai" , David Rientjes Subject: Re: SGX vs LSM (Re: [PATCH v20 00/28] Intel SGX1 support) Message-ID: <20190521151836.GA4843@linux.intel.com> References: <20190513102926.GD8743@linux.intel.com> <20190514104323.GA7591@linux.intel.com> <20190514204527.GC1977@linux.intel.com> <20190515013031.GF1977@linux.intel.com> <20190517000331.GD11204@linux.intel.com> <20190520114105.GD27805@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190520114105.GD27805@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 20, 2019 at 02:41:05PM +0300, Jarkko Sakkinen wrote: > On Thu, May 16, 2019 at 05:26:15PM -0700, Andy Lutomirski wrote: > > Is userspace actually requred to mmap() the enclave prior to EADDing things? > > Nope, not since v20. Here is what I wrote about API to the kernel > documentation: > > "The enclave life-cycle starts by opening `/dev/sgx/enclave`. After this > there is already a data structure inside kernel tracking the enclave > that is initially uncreated. After this a set of ioctl's can be used to > create, populate and initialize the enclave. > > You can close (if you want) the fd after you've mmap()'d. As long as the > file is open the enclave stays alive so you might want to do that after > you don't need it anymore. Even munmap() won't destruct the enclave if > the file is open. Neither will closing the fd as long as you have > mmap() done over the fd (even if it does not across the range defined in > SECS)." > > Enclave can be created and initialized without doing a single mmap() > call. We could even disallow mmap() before EINIT done. The way enclave management internally works right now is quite robust and completely detached from requiring process address space for anything. /Jarkko