Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5587495ybh; Wed, 7 Aug 2019 08:20:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf+cvIXU3L1KKI9wnqQVa2QnbHzKSRNfhn1w+0xryO60oAFFCnH5xjfzyOVrRe44tjEJ0O X-Received: by 2002:a63:5162:: with SMTP id r34mr7897916pgl.229.1565191199862; Wed, 07 Aug 2019 08:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565191199; cv=none; d=google.com; s=arc-20160816; b=DWC6IwvlTQnIjDd/qvTf5wthyhD5iF/QLRcqOyTjRf4gmN0o9DH9G53CxLK08pTCFE bAao+85jNHIWVVhJNPtkKI71AMVDyYkQJT86P2c2yonZUQNJIWfPxhdGi5ES6jWfTxKn 01w6sPBt6JZJ5v7wcBBGy8UMdT8P1OWZFVuurNby8hyWdLyXnzh+noJeIWwJxjj8K0Gs RmofWuMdLd3XKz/ezSZ33f4oPiPBv4H1nUyDA1vdsk99RObOsD2O5L4y2f33PBxBeoMl ZOBp847ItnZgKuSu1ahIoOQdjul0AZheuVR14ViGjvqxC7PDvUIFqbVnuNU55Neh4HCS q3UQ== 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=DE7AMF1cKJdKpGpaXFBCcSqZdIGzAvyAPTTfqpysi0k=; b=fyfugZbXhyuqAx4dtnuWSUgSBcflx7Rfy8f/VRYqveYAdVkxQ5BcTAqi55lPFlj3Fh /zMgkiHQ3fP8j938E/4r8m839NEWcEFEmyBPNRMbFe/Ac816s7P+jBh0b2nny9rgt44C WAQcuz9cyTbo43Um1YEzkVtgbpRP7PY4uhCDbXhrY48SW+XGIJB102h1FW1nmN94+PZy Qquhq6eFECY8eOumBL7XFoqj8zmXOow0IN8Kyu31q8vq7MjEy4FPz4p74p4vi++RrJ1r yXP0tuT1wBPn8EsQxKmTEEe2bq+u1lF0TcnTCDbN1GAe5EfcCnxPGvu+tXwEC9ldTP3n p4Zg== 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 o4si45649843plb.274.2019.08.07.08.19.44; Wed, 07 Aug 2019 08:19:59 -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 S2388078AbfHGPRJ (ORCPT + 99 others); Wed, 7 Aug 2019 11:17:09 -0400 Received: from mga05.intel.com ([192.55.52.43]:32606 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387777AbfHGPRJ (ORCPT ); Wed, 7 Aug 2019 11:17:09 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 08:17:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,357,1559545200"; d="scan'208";a="373803652" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.189]) by fmsmga005.fm.intel.com with ESMTP; 07 Aug 2019 08:17:04 -0700 Date: Wed, 7 Aug 2019 18:17:05 +0300 From: Jarkko Sakkinen To: "Ayoun, Serge" Cc: "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "linux-sgx@vger.kernel.org" , "akpm@linux-foundation.org" , "Hansen, Dave" , "Christopherson, Sean J" , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Katz-zamir, Shay" , "Huang, Haitao" , "andriy.shevchenko@linux.intel.com" , "tglx@linutronix.de" , "Svahn, Kai" , "bp@alien8.de" , "josh@joshtriplett.org" , "luto@kernel.org" , "Huang, Kai" , "rientjes@google.com" , "Xing, Cedric" Subject: Re: [PATCH v21 16/28] x86/sgx: Add the Linux SGX Enclave Driver Message-ID: <20190807151705.su6kxgr7ou45mk3p@linux.intel.com> References: <20190713170804.2340-1-jarkko.sakkinen@linux.intel.com> <20190713170804.2340-17-jarkko.sakkinen@linux.intel.com> <88B7642769729B409B4A93D7C5E0C5E7C65ABB8D@hasmsx108.ger.corp.intel.com> <20190807151534.kxsletvhbn3lno6w@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190807151534.kxsletvhbn3lno6w@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 06:15:34PM +0300, Jarkko Sakkinen wrote: > On Mon, Jul 29, 2019 at 11:17:57AM +0000, Ayoun, Serge wrote: > > > + /* TCS pages need to be RW in the PTEs, but can be 0 in the EPCM. */ > > > + if ((secinfo.flags & SGX_SECINFO_PAGE_TYPE_MASK) == > > > SGX_SECINFO_TCS) > > > + prot |= PROT_READ | PROT_WRITE; > > > > For TCS pages you add both RD and WR maximum protection bits. > > For the enclave to be able to run, user mode will have to change the > > "vma->vm_flags" from PROT_NONE to PROT_READ | PROT_WRITE (otherwise > > eenter fails). This is exactly what your selftest does. > > Recap where the TCS requirements came from? Why does it need > RW in PTEs and can be 0 in the EPCM? The comment should explain > it rather leave it as a claim IMHO. I mean after ~3 weeks of not looking into SGX (because being on vacation etc.) I cannot remember details of this. /Jarkko