Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1714303ybt; Thu, 25 Jun 2020 12:17:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqtEJ9/OOZThudm0K/jnxyNuDyXVX7lEJgGcz/stXjl9do/r8myjLFxX4SoeVt2XdVdWEP X-Received: by 2002:a17:906:5f98:: with SMTP id a24mr9529385eju.241.1593112668486; Thu, 25 Jun 2020 12:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593112668; cv=none; d=google.com; s=arc-20160816; b=iQKGU/W3eDbavARmEUmXU/FvuggQQaqORkxsCwyncYdLAq4X4gM6Pz4zb/VFCt2QXy JSAeWW2dwJXMxXhSi0SrRhdXkNmd79jw5G49RaKN6umrqviiyLCHXVO0BLZTTmu9j7Cw cYQWSPazF1p5rb9QzQ1iEWc3QiQ6BrHyDsWsQAn0Fm7tcCipVJN2YpHlUU7+eRXJxcxN yMJZrmltrq5ooesryq5s6zb4HS3lnLrMLum+jmihqnzZi+Oz5FbHOJXgRoyUOJSF19Pi P7ACHuRx/YFiKIHNHaEWHjsGpxmC5SPX8s1hwJFOTU2oVG7pJaUzMEkK5J1yjdPiLFaj HpFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cq3LKrRKJepHltbyBKhbhBaUgzsdqiaXd/tjkJyN1n0=; b=zf5JmtWujemBNm9gwg1WioI5Q9qS5zzI17g4ICoqnQ+bB21in3ti2I0r4sWRth5G0W aApqDA5tk7nIyi7qxUt1FZh5CTG9sD/4zH8/i7QPrsM1KqTNADn0GTozZZeoHBSua5h/ TPM9iyS88b1U+lVjLHaT6REZrYqN9liMdMg7qnQSRkM6Cwgkb/jA/9XtJdfLh6dD+pOJ HTzO8gOuP0KiajswZyrvFb58rvhFS8U/FSgjk+CKtXTBo0TgBCKJm8EybupkOwTz3g1V XTfkZWmCtqzfKMWnQH1Wv0I75+q4TKd7V7lFYoHgJCOh2sGjjWXTXBF7iw9xxd1SohNe qVsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=DPhYaS7I; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si4892678edw.391.2020.06.25.12.17.25; Thu, 25 Jun 2020 12:17:48 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=DPhYaS7I; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406356AbgFYSxh (ORCPT + 99 others); Thu, 25 Jun 2020 14:53:37 -0400 Received: from mail.skyhub.de ([5.9.137.197]:36834 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405853AbgFYSxh (ORCPT ); Thu, 25 Jun 2020 14:53:37 -0400 Received: from zn.tnic (p200300ec2f0ed100359123de3d1ebdc6.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:d100:3591:23de:3d1e:bdc6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 821C21EC03E4; Thu, 25 Jun 2020 20:53:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1593111215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=cq3LKrRKJepHltbyBKhbhBaUgzsdqiaXd/tjkJyN1n0=; b=DPhYaS7IuP6FQrvef2Yeoymx/XJnTO2nXLvxzCWexN3YYNoNlu/FKFUW8eH2BHK4WGjTNS 6PRYRcQ3dZdfQuH/Xnw5oLl4jo+eFabEJg39tyzGuKM6857nX2zp/pF4W47Ug19ifoFXk3 7OUJTwAE66U9gqY4Kzv3U/3Mb6LtYr0= Date: Thu, 25 Jun 2020 20:53:34 +0200 From: Borislav Petkov To: Jarkko Sakkinen 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: <20200625185334.GN20319@zn.tnic> References: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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. > 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) Other than that, nice explanation. I like that in a commit message. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette