Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp608958ybt; Fri, 26 Jun 2020 07:19:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMHc72MXIO9+p0k4dQscp0by4Dzj8D7JiahbAB63SZowjpuddZ/hIhmQbdr2Gntn9Ddrhw X-Received: by 2002:a17:906:4dd4:: with SMTP id f20mr2927986ejw.170.1593181168367; Fri, 26 Jun 2020 07:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593181168; cv=none; d=google.com; s=arc-20160816; b=dVKNYQJHSw143eEPtCVB2ilygjQBTDk/aCudmlWcD/RUaktoblLoiNQO4jav8kQoCF D/LR3FtV8NMOecNoHnNqwczfx8S8eYdEIbk0UvpfM4xuKUAPwFBn1ZRJbazn4e0XfycA kKEmbSFK+vRcRDd9M2SRyYvFAamCd3ZxyKA/HRzcxZTiUeV6HmlLH0g+cDV8JoRnLydT 5Yve0YghtjMr8U20U/OLjLswp3GG8R2ehK72JoPjYZMpxmD0n6e0b9uB4tqaq8XDF6eL 5btvxk3yGuMSTx0Ogcya98854Ak7G/ldXK6bodxUkLU52+LJVvm78/R93U/gELzDnqxQ bJsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=XQbXZhmDF50Nxkr9pE9sWRL0dIYJKpORceIfTloEkJo=; b=boGnPgoSQU6aJA9uKc1j0kLSx19+Ea3j7JRgNz+Why5qrin0xt8u5/mt83cqK5zO0e I7xJ5GDMjhHs2/Y15IvZC1naF4GRfNMeoWeimfay3d/o8YO21GH4yIAwqbs+5ZgNelUF ZRXAjxTpKpMLkaYtakgbrfol7GkvMUrgKM7QE7PfO/kRLTB62NTEZyZ3fQOh8D9/EGd5 BEaBObAt2Xa5u5pG3It7A79h+owbt55+vAVonH3YyPI6+1aNsIfIil3wBqB07SUTOi8k 16F+NwgUg0tB0FIaL0RgIooHVuY6tK2ehhBAOrZBFPBQCXstbq+0kjcYFZn5vO+m4A2D UxvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id zg6si10807483ejb.108.2020.06.26.07.19.05; Fri, 26 Jun 2020 07:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729056AbgFZOSG (ORCPT + 99 others); Fri, 26 Jun 2020 10:18:06 -0400 Received: from mga06.intel.com ([134.134.136.31]:6518 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgFZOSF (ORCPT ); Fri, 26 Jun 2020 10:18:05 -0400 IronPort-SDR: cumnl4v8tc1XbBOCo6zIW/OsTM1NdLBJNFnoAAhh5J/RXDj28JI+HbmGgQrlxOao5Nuhmg+PYC tgv12YTK2TwA== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="206855726" X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="206855726" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 07:18:04 -0700 IronPort-SDR: 1rhyS+hhPOwexxCnXZhmv6wxn+Llf5TDl1/SmHa/GLq44oSzAy+HP57dyLziLG/aUoUMBhtgs6 ZBJioV+2NSWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="320013816" Received: from cgheban-mobl.ger.corp.intel.com (HELO localhost) ([10.249.40.199]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jun 2020 07:17:51 -0700 Date: Fri, 26 Jun 2020 17:17:50 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Jethro Beekman , Haitao Huang , Chunyang Hui , Jordan Hand , Nathaniel McCallum , Seth Moore , Sean Christopherson , Suresh Siddha , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v33 11/21] x86/sgx: Linux Enclave Driver Message-ID: <20200626141750.GB390691@linux.intel.com> References: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> <20200625185334.GN20319@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200625185334.GN20319@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 25, 2020 at 08:53:34PM +0200, Borislav Petkov wrote: > On Thu, Jun 18, 2020 at 01:08:33AM +0300, Jarkko Sakkinen wrote: > > > Subject: Re: [PATCH v33 11/21] x86/sgx: Linux Enclave Driver > ^ > Add I'll change it to "Add SGX enclave driver". > > > Intel Software Guard eXtensions (SGX) is a set of CPU instructions that > > can be used by applications to set aside private regions of code and > > data. The code outside the SGX hosted software entity is disallowed to > > access the memory inside the enclave enforced by the CPU. We call these > > entities as enclaves. > > s/as // > > > This commit implements a driver that provides an ioctl API to construct > > s/This commit implements/Implement/ > > > and run enclaves. Enclaves are constructed from pages residing in > > reserved physical memory areas. The contents of these pages can only be > > accessed when they are mapped as part of an enclave, by a hardware > > thread running inside the enclave. > > > > The starting state of an enclave consists of a fixed measured set of > > pages that are copied to the EPC during the construction process by > > using ENCLS leaf functions and Software Enclave Control Structure (SECS) > > that defines the enclave properties. > > > > Enclave are constructed by using ENCLS leaf functions ECREATE, EADD and > > Enclaves > > > EINIT. ECREATE initializes SECS, EADD copies pages from system memory to > > the EPC and EINIT check a given signed measurement and moves the enclave > > checks > > > into a state ready for execution. > > > > An initialized enclave can only be accessed through special Thread Control > > Structure (TCS) pages by using ENCLU (ring-3 only) leaf EENTER. This leaf > > function converts a thread into enclave mode and continues the execution in > > the offset defined by the TCS provided to EENTER. An enclave is exited > > through syscall, exception, interrupts or by explicitly calling another > > ENCLU leaf EEXIT. > > > > The permissions, which enclave page is added will set the limit for maximum > > permissions that can be set for mmap() and mprotect(). > > I can't parse that sentence. Neither can I. > > This will > > effectively allow to build different security schemes between producers and > > consumers of enclaves. Later on we can increase granularity with LSM hooks > > for page addition (i.e. for producers) and mapping of the enclave (i.e. for > > consumers) I rephrased the whole paragraph: " The mmap() permissions are capped by the contained enclave page permissions. The mapped areas must also be opaque, i.e. each page address must contain a page. This logic is implemented in sgx_encl_may_map(). " > Other than that, nice explanation. I like that in a commit message. > > Thx. Thank you. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette /Jarkko