Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5916433ybi; Tue, 4 Jun 2019 14:46:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPX8+a7nt0oakd8E5H++K5l+JvL3uu5+GkLavC9hZXa7rOo8jvPyU/ipcquVKoBSQgrIzx X-Received: by 2002:aa7:9197:: with SMTP id x23mr4755272pfa.161.1559684763544; Tue, 04 Jun 2019 14:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559684763; cv=none; d=google.com; s=arc-20160816; b=uFu93a/LiZpOT6W8egq39tLl9GMfAZRY00lJvQ+OQdpIpZAxbesZeAf5VuuxsrtwUl iofxcTtH28k9g0qO9CAatQVBUWTJ/HcKV2epVb9151Ii/SKSPoeOkZdBf381VAcoCIIu Sa3R4blCSxC7/2OCjtAPLQm74b9vygzKbOeCtXJdfFSXE60M2nnuRoaDZaplz9srLKjv O+OFMWb9B6MB2NBZG3GLZsDWc6PX7dB1HJga9rGENG0WSyh11fTz0etLuWogW03w/p2u 7ggORJRoCnlKVDtNdIg4vvsav+cuVYk+WKU6vJr/3cOPC+Vg9P2d/DY265h6Y6wsLzvh FlAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=903esS9eUazAZ6uHOndCUHpHu7OoW+iS5LKF6oGN9UE=; b=hkHpKzkCqobOWgVtJTWpS5zBq+k/eujdoFa5pxDrsqAOcaFv92qgMfiGSpPKpTXlpJ O8Hg2GP31xzjFba1N1FfkUVUZBQP17Ah36sDo/lB3ZsY8IxVlADm22CFXhhN06hmMCAv Dgmk0anzGEmhyga6qBVlnbTIb+UUdpXqe8clI9IBCdBu83cy6U/G1vzVmk5J2a3AP1nH XibzC/86M4t6sudc2J4SBEDjhUUZdk+/NcrAXEK2iPba5G4h1imOVGgWXDT/xRZWD2sX FGiAFrgk3gi17QXyrehRkOCC6opuU04lbOzLGY1zPQ5OEQYumtX+WwcaQm0YLoiQdbsD QzIg== 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 w189si14879965pgw.205.2019.06.04.14.45.47; Tue, 04 Jun 2019 14:46:03 -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 S1726608AbfFDVnN convert rfc822-to-8bit (ORCPT + 99 others); Tue, 4 Jun 2019 17:43:13 -0400 Received: from mga09.intel.com ([134.134.136.24]:52309 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbfFDVnN (ORCPT ); Tue, 4 Jun 2019 17:43:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 14:43:11 -0700 X-ExtLoop1: 1 Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jun 2019 14:43:10 -0700 Received: from orsmsx151.amr.corp.intel.com (10.22.226.38) by ORSMSX110.amr.corp.intel.com (10.22.240.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 14:43:10 -0700 Received: from orsmsx116.amr.corp.intel.com ([169.254.7.165]) by ORSMSX151.amr.corp.intel.com ([169.254.7.185]) with mapi id 14.03.0415.000; Tue, 4 Jun 2019 14:43:10 -0700 From: "Xing, Cedric" To: "Christopherson, Sean J" , "Andy Lutomirski" CC: Jarkko Sakkinen , Stephen Smalley , James Morris , "Serge E . Hallyn" , LSM List , "Paul Moore" , Eric Paris , "selinux@vger.kernel.org" , Jethro Beekman , "Hansen, Dave" , "Thomas Gleixner" , 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 , "Roberts, William C" , "Tricca, Philip B" Subject: RE: [RFC PATCH 8/9] LSM: x86/sgx: Introduce ->enclave_load() hook for Intel SGX Thread-Topic: [RFC PATCH 8/9] LSM: x86/sgx: Introduce ->enclave_load() hook for Intel SGX Thread-Index: AQHVGAkjeU1nLGbLQ0COV0gRY1rFBqaMbZsAgAACI4D//5wC8A== Date: Tue, 4 Jun 2019 21:43:09 +0000 Message-ID: <960B34DE67B9E140824F1DCDEC400C0F654EDB7D@ORSMSX116.amr.corp.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-9-sean.j.christopherson@intel.com> <20190604203649.GC7775@linux.intel.com> In-Reply-To: <20190604203649.GC7775@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjk3ZmNiZGEtZTJkNi00ZTMzLWI3MzYtYzNlOTBlZTg5NzlmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiXC9oejQ4MHBleU1KeXlYQXU3S3JFeHhwK1d2WUJGRTJibitsMmRcL2YzQ3N4U0tOY29KSms0SEVSZWtiSmZxUE1PIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Christopherson, Sean J > Sent: Tuesday, June 04, 2019 1:37 PM > > On Tue, Jun 04, 2019 at 01:29:10PM -0700, Andy Lutomirski wrote: > > On Fri, May 31, 2019 at 4:32 PM Sean Christopherson > > wrote: > > > static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long > > > addr, diff --git a/include/linux/lsm_hooks.h > > > b/include/linux/lsm_hooks.h index 47f58cfb6a19..0562775424a0 100644 > > > --- a/include/linux/lsm_hooks.h > > > +++ b/include/linux/lsm_hooks.h > > > @@ -1446,6 +1446,14 @@ > > > * @bpf_prog_free_security: > > > * Clean up the security information stored inside bpf prog. > > > * > > > + * Security hooks for Intel SGX enclaves. > > > + * > > > + * @enclave_load: > > > + * On success, returns 0 and optionally adjusts @allowed_prot > > > + * @vma: the source memory region of the enclave page being > loaded. > > > + * @prot: the initial protection of the enclave page. > > > > What do you mean "initial"? The page is always mapped PROT_NONE when > > this is called, right? I feel like I must be missing something here. > > Initial protection in the EPCM. Yet another reason to ignore SECINFO. I know you guys are talking in the background that all pages are mmap()'ed PROT_NONE. But that's an unnecessary limitation. And @prot here should be @target_vma->vm_flags&(VM_READ|VM_WRITE|VM_EXEC).