Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3824439ybi; Mon, 27 May 2019 06:41:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCM3sk0xcUV/rvR7nsrwLlUY/Q3W0qCRVAeGxWfPMJEWyuRON+hCO5ef3f6s5MDYVJC1YV X-Received: by 2002:a63:7413:: with SMTP id p19mr123922845pgc.259.1558964480738; Mon, 27 May 2019 06:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558964480; cv=none; d=google.com; s=arc-20160816; b=VLa8d5IPUpBAH+HFwuP0R/IjtzPM6Su3he4BIyHrz6OTWMb8933ny7m2ICBTaBagzt 8qEpX/+uh2oEe1ngH3XafiaANfCHkT0jiHkIFrbI26fMJkw7ed9pmvn7EM1qE3wPNMQ1 EIH8E/ocoh+nLhwOuqQSiDN1EGUoxq3DGpLDYbEZOqnpgCusZ/kNFrajxfk1Kjl+ptAD TnnqZWebJBx/zJrcg5Xp1YnNl5GK+zWqmXNY99C6WvRic0GEau1A7q+dtkqNuJSFWUy+ sopVNVWwA9ySTnoKR55X+h4T1Y1OwsLx4ZIIvKTm9zhkEVxWM9YWRovbP7UQKtbR6kge CHQA== 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=4ADyeY9Qg5+nqBTyza4qXZfWw7B9raa2SUlFVf74LDY=; b=UssEmAdwzgoZAKRlTQWWH0jA083NAGADLwceg38Lq/SZR2kMVKJ1bQdLBLBFWSqAgy zkxf+6yUKFx3JwKDD2R9gN2CR0TKr3GFiBc+NJqC1mt8J4k0KVayjEe1t3LS0+rPmHyu 3H2g3uW4GpMmlSWH1bNVP9iLi99rBd/OLvpkfa6Rx/lG88GOJy6CwdSdQqrco1Gvy9jU 6dQIXPzrBB0Q+yyb/JKVtht3e78K/Q5xh3zdrnLRs1s3WQHqK9yGz6YRVSLYRzGE+3MX qUBYHUpjeBPOaOqVCVekHpYUlB/QZc5LE6BBT54DoNCB8l25winq7opTVYy95K49RgYe uI7g== 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 m2si18129274pgd.256.2019.05.27.06.41.05; Mon, 27 May 2019 06:41:20 -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 S1726722AbfE0NjA (ORCPT + 99 others); Mon, 27 May 2019 09:39:00 -0400 Received: from mga02.intel.com ([134.134.136.20]:30882 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfE0Ni7 (ORCPT ); Mon, 27 May 2019 09:38:59 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2019 06:38:58 -0700 X-ExtLoop1: 1 Received: from pgomulkx-mobl.ger.corp.intel.com (HELO localhost) ([10.251.94.230]) by orsmga006.jf.intel.com with ESMTP; 27 May 2019 06:38:45 -0700 Date: Mon, 27 May 2019 16:38:39 +0300 From: Jarkko Sakkinen To: Sean Christopherson Cc: Andy Lutomirski , Stephen Smalley , James Morris , "Serge E. Hallyn" , LSM List , Paul Moore , 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: <20190527133839.GB9732@linux.intel.com> References: <20190521155140.GE22089@linux.intel.com> <20190522132022.GC31176@linux.intel.com> <20190522132227.GD31176@linux.intel.com> <0e183cce-c4b4-0e10-dbb6-bd81bea58b66@tycho.nsa.gov> <20190522153836.GA24833@linux.intel.com> <20190523023517.GA31950@linux.intel.com> <20190523102628.GC10955@linux.intel.com> <20190523141752.GA12078@linux.intel.com> <20190527133418.GA9732@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190527133418.GA9732@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 27, 2019 at 04:34:31PM +0300, Jarkko Sakkinen wrote: > On Thu, May 23, 2019 at 07:17:52AM -0700, Sean Christopherson wrote: > > 1. Do nothing. Userspace would essentially be required to mmap() the > > enclave after EINIT, which is ugly but not breaking since userspace > > could mmap() the enclave with a placeholder VMA prior to building > > the enclave, and then a series of mmap() to establish its "real" > > mapping. > > What it'd break to return error if mmap() is done before EINIT? > > > 2. Propagate the permissions from EADD to the VMAs of the current mm > > if the entire EADD range is mapped and the mapping is PROT_NONE. > > Right now you can do multiple mmap's. If the mmap's must be done after > EINIT, the driver could check that permissions match the permissions in > that range. > > This leaves open how to deal with mprotect() but if the process does not > have FILE__WRITE I guess you cannot do much. > > > 3. Propagate the permissions from EADD to the VMAs of all mm structs > > that have mapped some piece of the enclave, following the matching > > rules from #2. > > For me it looks that allowing mmap's only after EINIT would result the > least confusing implemntation. Obvious problem is of course the requirement of fixed mapping, which is of course nasty. /Jarkko