Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3779907ybi; Sun, 2 Jun 2019 23:29:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKNN02qFvhGBEPCpLG/wufSeA4bnfZ/lqDzX5i5/12wkluMZEYQ6DTmlbZq46bHp2v6XBH X-Received: by 2002:a62:1483:: with SMTP id 125mr29137767pfu.137.1559543378936; Sun, 02 Jun 2019 23:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559543378; cv=none; d=google.com; s=arc-20160816; b=b2YJVjBVmoOhqMhD690YKXN+hNhMMWZIIKY2veczkyxeN1BbublX83BFaziU0KjghF xmwRjywaIgciyPSgWD0r8pZ132NCHW4MkIZU0r6jWRpMiXtrmeE/oSzEQ4kHUdYxNv+r ORhJB545jxON1ClDyXyop/lMbUa310BY73Y+tlu8uvpJGo9A1K49uknBvePbIKAy+GtO 7pmepjBcbZuZdIgY5IdG8y7lGEvtcAWXNKsoe/YUkbWwYUp2Of26l1YSSSmx8F0xqCUY TbVZwZhtp6i9ojOijtqiaGB8mUN+QE8mBPBnR92nTtZOaxO9HKN3hHGusr8lnNAODZ/9 gKGQ== 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=+fKNqlD/WlbDFWvgfJ+1WI6FQ664eail4C8w134lmKQ=; b=NxcXgn0/Kx3K2003JLvNlHkCnjbkyOVznQ/hJW1x4IPLJj4TW1lEwjYhNmZPSZ4PF5 +qNRmN0cvOeRHp60niglGvSAkfZLjT0Ty8L9g3PreElSBQTLJMz1L+3dH9tbQajARVay 1ibu3rfuvtaPld3GGvgUqJOORV+hCHJmBgL1QpAn28UUyA1EYz4pMjn1hmHEQZG25LYU fSBUyenQlbBrBkztt5n0nt1SCbxOLalLxpqIPvQq1IGAIc+Nn9GvWV9VKaa4oX/Owdak SzjdmZy/nlk6vvlYed+nF1H2soBYBtKgjWITdZrwZcT1PRVi+nnHMcgO8QTr0d+7EQR0 jV7A== 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 z72si16996328pgz.56.2019.06.02.23.29.22; Sun, 02 Jun 2019 23:29:38 -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 S1726990AbfFCG2H convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Jun 2019 02:28:07 -0400 Received: from mga02.intel.com ([134.134.136.20]:38124 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbfFCG2H (ORCPT ); Mon, 3 Jun 2019 02:28:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2019 23:28:06 -0700 X-ExtLoop1: 1 Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga005.jf.intel.com with ESMTP; 02 Jun 2019 23:28:05 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 2 Jun 2019 23:28:05 -0700 Received: from orsmsx116.amr.corp.intel.com ([169.254.7.165]) by ORSMSX159.amr.corp.intel.com ([169.254.11.57]) with mapi id 14.03.0415.000; Sun, 2 Jun 2019 23:28:05 -0700 From: "Xing, Cedric" To: "Christopherson, Sean J" , "Jarkko Sakkinen" CC: Andy Lutomirski , 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: AQHVGAkjeU1nLGbLQ0COV0gRY1rFBqaJcW8w Date: Mon, 3 Jun 2019 06:28:04 +0000 Message-ID: <960B34DE67B9E140824F1DCDEC400C0F654ECC11@ORSMSX116.amr.corp.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-9-sean.j.christopherson@intel.com> In-Reply-To: <20190531233159.30992-9-sean.j.christopherson@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDY1NDk3MjItY2ViNC00NTU1LTk0YmEtZGY0ZWZjYmUyMWNiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTVwvRWlaemdWMVwvY0JVb1hhODlWSVdyV0tXb1daNHI3UkhnaUx1VkFcL05LNVBQQUJmSTQyZHk1WEd6bjdITW9kMSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.22.254.138] 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: Friday, May 31, 2019 4:32 PM > > diff --git a/include/linux/security.h b/include/linux/security.h index > 659071c2e57c..2f7925eeef7e 100644 > --- a/include/linux/security.h > +++ b/include/linux/security.h > @@ -392,6 +392,8 @@ void security_inode_invalidate_secctx(struct inode *inode); int > security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); int > security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); int > security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); > +int security_enclave_load(struct vm_area_struct *vma, unsigned long prot, > + unsigned long *allowed_prot); Per my comments to the cover letter, security_enclave_load() should have a signature similar to the following: int security_enclave_load(struct file *enclave_fd, unsigned long linear_address, unsigned long nr_pages, int prot, struct vm_area_struct *source_vma); @enclave_fd identifies the enclave to which new pages are being added. @linear_address/@nr_pages specifies the linear range of pages being added. @prot specifies the initial protection of those newly added pages. It is taken from the vma covering the target range. @source_vma covers the source pages in the case of EADD. An LSM is expected to make sure security_file_mprotect(source_vma, prot, prot) would succeed before checking anything else, unless @source_vma is NULL, indicating pages are being EAUG'ed. In all cases, LSM is expected to "remember" @prot for all those pages to be checked in future security_file_mprotect() invocations. > #else /* CONFIG_SECURITY */