Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5861122ybi; Tue, 4 Jun 2019 13:38:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxER2alyqnJM5ntSImFGb/VFYdmkogisacWq25FE7qFRuI7uJ3QUye1KJNGhHnRMG7wNTG1 X-Received: by 2002:a17:902:521:: with SMTP id 30mr39463463plf.62.1559680723745; Tue, 04 Jun 2019 13:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559680723; cv=none; d=google.com; s=arc-20160816; b=DdwkuUZCP5V06GHXYjSvjcHR2Q8qtR1EVYagmSUg3c2vq4Jho7+zCb/fYiSQLLmiVW 3W4n2gCBUWzpDpcH+0iW7OeSpzFvlAUQN+BfLPbVa7U2RMgjYrdwC80Vfj3qV20bSeHe z3po9wtQFTGSFdcN1CZ5aPdkHCxIddTzX1PA0meNFIw9e0EuWMFj/Odj5PQ/L4bz+8NK eDNiP+nEuRrCKrp9raXfJooZ3u/r49m0FILoWQMniIPPjmXTt6X0liqQSik4r8dW0ode cjyVWZRYlQ3r8LU3FfOiKL+C6WvzJOrd3qiDaDEvOG3sOCb7YIOr6LqnAhIyPpdB5Xoy yz0w== 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=yEr6jBNqgksDp2q4RsTsHUaUN2NkvL172TGuIAgRCmk=; b=HyBOMD1ccVnClYjGl7vffpG5zJUpvJe1dMu6uQZMCS05F58yiy6EMF2c9KUlwU1+cE ZlmfGjXXbgsXohfdAQtk1jpe6cas2g3YraeS9dSEsC94hnGOOvzqVx9xioyP4vVA18p3 Z3uEr+pvCs7+bXUe5z39YRNZzoFZA9wCMWu3lhw2YlibSvQpFmL0IEHCAYf6s7v44GsR PbNpkh6gpz50kShzjMhxSXko8kb7bcv7lPMOYYtV9DUF/rLPwKlcfqxIVJUAOK0iQYMd X5ZfMEz1z7Ekg35lJ3gt0U6T+0ne3T1mRSoa2Mz0HCYZ88vwA1tfvPxFyRcCt7oAtApv 6t9Q== 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 q13si2047167pgq.496.2019.06.04.13.38.26; Tue, 04 Jun 2019 13:38:43 -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 S1726701AbfFDUgv (ORCPT + 99 others); Tue, 4 Jun 2019 16:36:51 -0400 Received: from mga01.intel.com ([192.55.52.88]:44647 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726033AbfFDUgu (ORCPT ); Tue, 4 Jun 2019 16:36:50 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 13:36:50 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by fmsmga001.fm.intel.com with ESMTP; 04 Jun 2019 13:36:49 -0700 Date: Tue, 4 Jun 2019 13:36:49 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Jarkko Sakkinen , Cedric Xing , Stephen Smalley , James Morris , "Serge E . Hallyn" , LSM List , Paul Moore , Eric Paris , selinux@vger.kernel.org, Jethro Beekman , Dave Hansen , Thomas Gleixner , Linus Torvalds , LKML , X86 ML , linux-sgx@vger.kernel.org, Andrew Morton , nhorman@redhat.com, npmccallum@redhat.com, Serge Ayoun , Shay Katz-zamir , Haitao Huang , Andy Shevchenko , Kai Svahn , Borislav Petkov , Josh Triplett , Kai Huang , David Rientjes , William Roberts , Philip Tricca Subject: Re: [RFC PATCH 8/9] LSM: x86/sgx: Introduce ->enclave_load() hook for Intel SGX Message-ID: <20190604203649.GC7775@linux.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-9-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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.