Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2940786imu; Mon, 19 Nov 2018 08:22:23 -0800 (PST) X-Google-Smtp-Source: AJdET5fsCU5sv/MyVh+laixB7Ez5CAWRIV1n5p/d79W4EDCX9dhkov1dXqtCAnDmbj8b3vYM/03T X-Received: by 2002:a62:29c4:: with SMTP id p187-v6mr23491100pfp.62.1542644543683; Mon, 19 Nov 2018 08:22:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542644543; cv=none; d=google.com; s=arc-20160816; b=iWMwj836YrCTVOpwfMzxWbNsRAc04O4h9Zp8gKKnhdi0UCxuWESmC6kQi5t49RCJ19 n5vifzGPGhRdWkztLDKqrSctBPyXhVPZtMfileJTC58y7sJkbr41Sk2KLiOZ4calJYa/ JCGOpgKJPWg/7HgJaAqFamIY2sMKFFNgV2iDMpeco0zMCDwuwyc8p8T3fLqNouH3OmDO qho3B+eDq1uLO8EnxMcbqm6i60P9TKnt4m7IA2xHz3BLPAYjeVOlE8YF/a7z+qMRyCVS y+hOBEXXL4VY3gRKQ2wUErEdYwiGWyiv562sgdQYw6egcHfM/g1SpFka4J62cPjckRpI /AOg== 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=py/6xaoGMpmghpRkLiH1VkbPI9WSbSjnhF6uTJrQghM=; b=w2iItrMoSkJ55gPzfHoHq5oKcG/bPskvQ2bcKJRZrEJ+eAqmLrVWayHx8ukICoOmy8 sppm5Cv2VQV7H8CAeyXcDIUrVy5sHZo59gP3SQCU3hiSyXZGPevAaO/FvnoGP8K1hrqY MMIsufH2b9S/H+SCmy4TFp9nbovZANAdEIhAJMccx5g7p/zU4aPYK7Uy3lUJlSzVX68Z MhP9mUxq4fqzVQdyoPTFTg1O1ezHL+fMITImE9hWzSmMk1eQB5/L1jOKKHls67F36A76 Cw+zFvrTCp44opOZ78dIKAGKn+IVwTgIE77J0a0xHYloobIh9BtIA/b8PG+VaA6xCf/j u+8Q== 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 ay1si9417444plb.410.2018.11.19.08.22.07; Mon, 19 Nov 2018 08:22:23 -0800 (PST) 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 S1730035AbeKTCn3 (ORCPT + 99 others); Mon, 19 Nov 2018 21:43:29 -0500 Received: from mga11.intel.com ([192.55.52.93]:51398 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729928AbeKTCn2 (ORCPT ); Mon, 19 Nov 2018 21:43:28 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2018 08:19:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,253,1539673200"; d="scan'208";a="101482710" Received: from tmuluk-mobl4.ger.corp.intel.com (HELO localhost) ([10.249.254.135]) by orsmga003.jf.intel.com with ESMTP; 19 Nov 2018 08:19:18 -0800 Date: Mon, 19 Nov 2018 18:19:17 +0200 From: Jarkko Sakkinen To: Andy Lutomirski Cc: X86 ML , Platform Driver , linux-sgx@vger.kernel.org, Dave Hansen , "Christopherson, Sean J" , nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, haitao.huang@linux.intel.com, Andy Shevchenko , Thomas Gleixner , "Svahn, Kai" , mark.shanahan@intel.com, Suresh Siddha , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Darren Hart , andy@infradead.org, LKML Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver Message-ID: <20181119161917.GF13298@linux.intel.com> References: <20181116010412.23967-1-jarkko.sakkinen@linux.intel.com> <20181116010412.23967-19-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Nov 19, 2018 at 07:29:25AM -0800, Andy Lutomirski wrote: > On Thu, Nov 15, 2018 at 5:08 PM Jarkko Sakkinen > wrote: > > > > 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 enclave is disallowed to access the memory > > inside the enclave by the CPU access control. > > > > SGX driver provides a ioctl API for loading and initializing enclaves. > > Address range for enclaves is reserved with mmap() and they are > > destroyed with munmap(). Enclave construction, measurement and > > initialization is done with the provided the ioctl API. > > > > I brought this up a while back, and I think I should re-ask it now > that this driver is getting close to ready: > > As it stands, there's just one SGX character device, and I imagine > that it'll be available to unprivileged applications. I'm concerned > that this isn't quite what we want. I certainly think that everyone, > or at least almost everyone, ought to be able to run normal enclaves. > But I think that we should consider restricting who can run specially > privileged enclaves. In particular, the ability to run enclaves with > the provisioning bit set is somewhat sensitive, since it effectively > allows access to a stable fingerprint of the system. Before flexible > LC, this wasn't such a big deal, since only Intel's provisioning > enclave could see the key, and Intel's enclave has some degree of > control of what is done with the key. With flex LC, this protection > is lost. > > But this is maybe more of a big deal than just access to a stable > fingerprint. The ability to provision a remote attestation protocol > is a key part of running SGX malware, and SGX malware is surely going > to exist some day. (Sure, Intel will try to block access to the > actual attestation service for malware, but I doubt that Intel will be > able to fully defend it.) > > So I propose that there be a few device nodes. Maybe > /dev/sgx/unprivilegd and /dev/sgx/provisioning? The default mode of > the latter could be 0600. If you've opened the unprivileged node, you > can only run enclaves without any special permission bits set. What would the use case for unprivileged i.e. this configuration would mean depending on permissions? There would be three types of users: 1. Ones that have access to neither of the devices. 2. Ones that have access to unprivileged. Who are these? 3. Ones that have access to provisioning. > We should also consider whether we allow the unprivileged node to run > launch enclaves, and, for that matter, whether we allow user code to > run launch enclaves at all, given that they're not useful with the > current architecture of the driver. ATM the launch enclave bit is disallowed by the kernel in the current patch set. I don't really see any use case to allow them except if we want to allow run enclaves in an environment where the MSRs are rdonly. /Jarkko