Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7485375ybi; Wed, 5 Jun 2019 19:06:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx49v0tr4lGqFLelYc7OhtFZmvFlXK5G+mOKhOTIlT7uc7Epe4IPUWaT4LYqBfY//hcIyWT X-Received: by 2002:aa7:9342:: with SMTP id 2mr42132389pfn.241.1559786769190; Wed, 05 Jun 2019 19:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559786769; cv=none; d=google.com; s=arc-20160816; b=lVr3AW8Huk3ZwLMvVdBWYAI/sggQwOVRhAgn0+q7jyoXWl4BLpuFddSi+SoUG+c/cT lHlKKSNVwIA/m+OC++jdiOc5yHriTDWrE2GrxpxZ+s7f3NmfeM8SYxpJr5Q6WNuW1Ip7 tehC24p5O08GdZyXd8mvUVSxqmkWxggbAf8YXx2eEb5aLbCPdE83AAmRgZoaVU0I5iOa GMw+n2/pqEAyB04+DrrR2Ep/b9MTp7F/kGUQuKMmQRE3ok1wFkkn8nXiANdN2Pciu1+G 4u2Fuw995xd8sMnXhIu0kT0LZiMjjAehPOqt2+vsJurmic1KyMPwiR1a3Z3irbQYPNi/ W9IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4/yPyd1bMCqc0U1C4FJcsDvPlmjiBj/f2+UfefOhiek=; b=cMR9H+5PG3y8n/YsFYiRktnaH0V0nC5zlQ8VoLygCFpcCvNaLOoLz796csRtS4PJMh bFx9ePn/TMq2j6Ao+3VEX5HpaR172CMovQzlCirIEEirEJQbReCkQUEPv2tLrMfL1jLy fEzuB78FgoGH1ILriH+JKDQsRRdmDvBkakUxHCO5v4cNqkI7zfl3r4JJG/5z6puKJboP 7KA13hU9WdDAltMdOlxoRyu34qqNVR+0TXU05ZdNPYIH+rOI7IDDkdQ0fnqey/hg6Eig oIuaOlBdFxe2p3DmovMDyNjBclSVTUxM7DOjTvpGNywFCiyqQ3u/2mFwOPhTJsg4XfXs HuIQ== 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 s6si271825plq.246.2019.06.05.19.05.52; Wed, 05 Jun 2019 19:06:09 -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 S1726729AbfFFCET (ORCPT + 99 others); Wed, 5 Jun 2019 22:04:19 -0400 Received: from mga17.intel.com ([192.55.52.151]:61296 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbfFFCET (ORCPT ); Wed, 5 Jun 2019 22:04:19 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 19:04:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,557,1549958400"; d="scan'208";a="182148358" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2019 19:04:17 -0700 Date: Wed, 5 Jun 2019 19:04:17 -0700 From: Sean Christopherson To: "Xing, Cedric" Cc: Andy Lutomirski , 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 Message-ID: <20190606020417.GL26328@linux.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-9-sean.j.christopherson@intel.com> <20190604203649.GC7775@linux.intel.com> <960B34DE67B9E140824F1DCDEC400C0F654EDB7D@ORSMSX116.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <960B34DE67B9E140824F1DCDEC400C0F654EDB7D@ORSMSX116.amr.corp.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 02:43:09PM -0700, Xing, Cedric wrote: > > 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. Not all pages have to be mmap()'d PROT_NONE, only pages that do not have an associated enclave page. > And @prot here should be @target_vma->vm_flags&(VM_READ|VM_WRITE|VM_EXEC). I don't follow, there is no target_vma at this point.