Received: by 2002:a17:90a:37a3:0:0:0:0 with SMTP id v32csp4120267pjb; Mon, 10 Jun 2019 10:45:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtRvf6WUf9qGt3RruyOJPF/MdL0CB4/ga9a6zNYth8oGF8yLWfuQTdvk0mONs6kAJlKXb9 X-Received: by 2002:a17:902:2006:: with SMTP id n6mr14124864pla.232.1560188750615; Mon, 10 Jun 2019 10:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560188750; cv=none; d=google.com; s=arc-20160816; b=ifxlca//qfQsgFjldRBtxXpEE6LK7qPgm8/dXPRdRRvHw03P4fwkMvFFr0sfnQwnIq 0ZHnfpgqRrdYiEVsN4KcTnq9kNqKytm9F1jkl5qUWYS/vysUCiz1Ii/p+WPtYeLvCCdY lEUONOwBltD1TDqwcHJhOShR8aKt0ZxfSE2C35LTZ+npLPFOLE+iirJHCqJj6dXrOmIK 8RE9OS5kRw8TtJ7WrBFMGlhoeSoTvruBg53/Cuh4Wp5EaiTLX1XgR5VO1khP7BqBUhB9 HoXOJCptBLsHQ8aW96Xm7gWM5EEiRnuKlM9Us3CWrFAjj44yNlt2PgAQ/yFPljayfZ60 Ud5g== 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=3YFx8BKN//9dqxYi5XBs02YULp4NSbPYR+wPRRUYmNY=; b=cRq9wVbstORDJAvcX/RLbiGBlwQ8eUNrVbbjQdEfF8ZXvWWCrOtRr6xU1V7g2HPM2r r8aaeJFBNjuPBNbhf3sxi0w25dzLCACjOOpUj6aUsmMY4+XzK9Z13cDa63R3YNiCEB/8 2HeL+F7LM0F4TiAzq7tcU95N4gz+ol9hAHOKE2y4FLzJdwl15Do9Dmvm0TgvQa0asKCA DbfDFwCy83oaO0Z3UYOF2xO6ok2kxZXbcJBkb5QHzOuavKFhwEYoY2XeV34e2XgmiBBF lsFK5ZQLXyohhDw3OSb3EsDJXGo5jCL+a+nzW3T4nC30kwkZp9QVQHsoyajLDazn9iQF +bZQ== 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 h12si3675769pgn.550.2019.06.10.10.45.35; Mon, 10 Jun 2019 10:45:50 -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 S2388414AbfFJRp1 (ORCPT + 99 others); Mon, 10 Jun 2019 13:45:27 -0400 Received: from mga06.intel.com ([134.134.136.31]:38816 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388342AbfFJRp1 (ORCPT ); Mon, 10 Jun 2019 13:45:27 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 10:45:26 -0700 X-ExtLoop1: 1 Received: from cmargarx-wtg.ger.corp.intel.com (HELO localhost) ([10.249.34.77]) by orsmga007.jf.intel.com with ESMTP; 10 Jun 2019 10:45:13 -0700 Date: Mon, 10 Jun 2019 20:45:06 +0300 From: Jarkko Sakkinen To: Sean Christopherson Cc: Andy Lutomirski , 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 v2 2/5] x86/sgx: Require userspace to define enclave pages' protection bits Message-ID: <20190610174506.GB13732@linux.intel.com> References: <20190606021145.12604-1-sean.j.christopherson@intel.com> <20190606021145.12604-3-sean.j.christopherson@intel.com> <20190610152717.GB3752@linux.intel.com> <20190610161532.GC15995@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190610161532.GC15995@linux.intel.com> 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 Mon, Jun 10, 2019 at 09:15:33AM -0700, Sean Christopherson wrote: > > 'flags' should would renamed as 'secinfo_flags_mask' even if the name is > > longish. It would use the same values as the SECINFO flags. The field in > > struct sgx_encl_page should have the same name. That would express > > exactly relation between SECINFO and the new field. I would have never > > asked on last iteration why SECINFO is not enough with a better naming. > > No, these flags do not impact the EPCM protections in any way. Userspace > can extend the EPCM protections without going through the kernel. The > protection flags for an enclave page impact VMA/PTE protection bits. > > IMO, it is best to treat the EPCM as being completely separate from the > kernel's EPC management. It is a clumsy API if permissions are not taken in the same format for everything. There is no reason not to do it. The way mprotect() callback just interprets the field is as VMA permissions. It would also be more future-proof just to have a mask covering all bits of the SECINFO flags field. /Jarkko