Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4665303ybi; Mon, 3 Jun 2019 15:07:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwo1TgQOgszkYw6DT0HQi4u7K12Q3IJ34eyS+GgBgEvrO1amb41vGpCgf0+fId7GhrzL2F X-Received: by 2002:a17:902:2be8:: with SMTP id l95mr30815394plb.231.1559599625692; Mon, 03 Jun 2019 15:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559599625; cv=none; d=google.com; s=arc-20160816; b=N+LveH35uivlP11F7Kqz0qowOdipZwpiJ8YpPn7ZjXXzMtiDywwE56HupIsxqhRphS YwNcNhm80l3iRWUtvdnCpVuQdXJDzmfZbesbGHveDXhSi6NkO+a25YbqRh10JPXk30BM X+/H30Kb2zyIsVcpYzFpLCkMaka+CYd+ApsR3VUyLfbOHH/OKBHxQz92LrqMR9VuUEjN e/46z4yInRTxLs414/f5drhx95j+Omc/uyhJTVEesXFYHa2iqbwsqIpkV8G7b2iFjXce OngjF3n6EZLrsI3XX/T5SFQWNuEZ9bHdWCscx5PpOxRqxXRAyiCS9ehJADXzoMKA7Ndd 23ig== 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=EGGf/N4dKPSUps76hk9lxWJ7/jCzvFV/1y/VnBS5n3A=; b=qMhY/FXUlZqtbGf1FKbAg6ZurJZRvqe3Eq0VfPUeOCjjNq2Rzp48AeOjEBf+PxswAE DlTN9TCUVspbdjeM/UFMX1HmgYhG3TPiA0pVM9j+irU8Akwq3Q17xB5WhWdexIKk7lvP cv27lj+ZtIlgBSBBW3/hm//+Ftyzo+2KppsYypxycoOHqMXthReF0esVnWEiwc+hijsd +MsTDddPVbqmnK11Fn6Wc+mThAfyY8YHnyVKQxyDMJTrF/OYrPRQHcQKceCAgkYi5xqc rJ0WBnY5z84T3CXgwHDb0Q3HCgE7mu2ry1AXn1a7cr86sDoX0b1KRevC3eKmg9pHA3BE zghg== 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 m14si19955335pls.393.2019.06.03.15.06.48; Mon, 03 Jun 2019 15:07:05 -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 S1726754AbfFCWFj (ORCPT + 99 others); Mon, 3 Jun 2019 18:05:39 -0400 Received: from mga05.intel.com ([192.55.52.43]:46272 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbfFCWFi (ORCPT ); Mon, 3 Jun 2019 18:05:38 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 13:44:07 -0700 X-ExtLoop1: 1 Received: from jgaire-mobl.ger.corp.intel.com (HELO localhost) ([10.252.20.169]) by orsmga004.jf.intel.com with ESMTP; 03 Jun 2019 13:43:54 -0700 Date: Mon, 3 Jun 2019 23:43:53 +0300 From: Jarkko Sakkinen To: Andy Lutomirski Cc: Stephen Smalley , "Xing, Cedric" , "Christopherson, Sean J" , William Roberts , James Morris , "Serge E. Hallyn" , LSM List , Paul Moore , Eric Paris , "selinux@vger.kernel.org" , Jethro Beekman , "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: <20190603204353.GC4894@linux.intel.com> References: <20190524224107.GJ365@linux.intel.com> <683B5E3D-AFB6-4B45-8D39-B00847312209@amacapital.net> <960B34DE67B9E140824F1DCDEC400C0F654E965F@ORSMSX116.amr.corp.intel.com> <960B34DE67B9E140824F1DCDEC400C0F654E9824@ORSMSX116.amr.corp.intel.com> <20190528202407.GB13158@linux.intel.com> <285f279f-b500-27f0-ab42-fb1dbcc5ab18@tycho.nsa.gov> <960B34DE67B9E140824F1DCDEC400C0F654EB487@ORSMSX116.amr.corp.intel.com> <678a37af-797d-7bd5-a406-32548a270e3d@tycho.nsa.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, May 30, 2019 at 07:31:14AM -0700, Andy Lutomirski wrote: > - To create an X mapping of an enclave page that came from EADD, you > need EXECUTE on the source file. Optionally, we could also permit > this if you have EXECMOD. Source file? EADD ioctl takes memory buffer in right now. > And I have two design proposals. One is static and one is dynamic. > To implement either one, we will probably need a new .may_mprotect vm > operation, and that operation can call an LSM hook. Or we can give > LSMs a way to detect that a given vm_area_struct is an enclave. As I > see it, this is an implementation detail that is certainly solveable. Why VM operation and not file operation? > EADD takes an execute_intent flag. It calls a new hook: > > int security_enclave_load(struct vm_area_struct *source, bool execute_intent); > > This hook will fail if execute_intent==true and the caller has neither > EXECUTE, EXECMOD, nor EXECMEM. > > EAUG sets execute_intent = false. > > EINIT takes a sigstruct pointer. SGX can (when initially upstreamed > or later on once there's demand) call a new hook: > > security_enclave_init(struct sigstruct *sigstruct, struct > vm_area_struct *source); What is the source VMA in these callbacks? Why is @execute_intent needed anyway as a ioctl arugment and not deduced from SECINFO? /Jarkko