Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp503137imm; Wed, 20 Jun 2018 01:48:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJDoaYQpW1YSYxby/3gXqiOPUZCp6Ni/yK1Ogorc6PBosd3U+HAMeioBr2+N9aNvWO7WjBS X-Received: by 2002:a65:52cd:: with SMTP id z13-v6mr6857589pgp.357.1529484525714; Wed, 20 Jun 2018 01:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529484525; cv=none; d=google.com; s=arc-20160816; b=PkT+Lnirndr48VJvZoVu/xCgkoQmPFYJNf9Q5EdsLzRL8sERWxpgh8O1NQSTzTmn7M DfQVpIn7I1FYJRNwajZIteSnCrl0eLhAjn/TVJnjVwzNutzWyPXRdToXo1Uq5B+5n2zm x/fH4aVhgIS3Ii9NZGfAkzc7kyyS0DP+6n6vUF2mhELttT2Cq796xDgRJ9GQOYvzYnqh OBgJpo9iNCoaU6RET/yxDobL/azr4qrxLBFwSu+ZD+GdNVEJK9KsIxMPkCO8ZSOZqnzv mCDh5QYnBPTbGtc5GC4YB1n9TUJXu1X51SqSvb2Ec1CMgGSb+O6ZRKfznPI5iVc59c0m g3GA== 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:arc-authentication-results; bh=sMrMIrpTYrDZl81l0wzBrEPJE2kPu9W7v4sDIbAu6BM=; b=qlWPUkxCmQIClw3qAhFyS9IWZh/l3KlGXZpmo1pGqYvqF57jTJciGDQF6vkLYRyQTI xXn6gb4yBkqaWmjzrH9LczlWxnjmHOM+jd5T3+wSqMdqKNZp6Bv+AFhxcScfUErfZ0mN Pf4IID4htc9M0It3gyBMqtG4KFRxA9B8EnOdWf/+HC8a4gqaYXOURJ8oUzcsfPz/7YWU AmpQWmWwPnRuqy1NZuqLQMqJLewWLL9csO3jSxfoimBzCvfA73F5b9mKkfU+KZV7UZed 2mq2t6xiU5YuIpggSGUUKVIy7cbxVRheiM3hEAIBk/7MbmYchh4uKFgcdw8oW+MG15za h5AA== 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 17-v6si1941187pfn.37.2018.06.20.01.48.31; Wed, 20 Jun 2018 01:48:45 -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 S1754662AbeFTIqy (ORCPT + 99 others); Wed, 20 Jun 2018 04:46:54 -0400 Received: from mga14.intel.com ([192.55.52.115]:34715 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932224AbeFTIqt (ORCPT ); Wed, 20 Jun 2018 04:46:49 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2018 00:23:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,246,1526367600"; d="scan'208";a="48473526" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.52]) by fmsmga007.fm.intel.com with ESMTP; 20 Jun 2018 00:23:50 -0700 Date: Wed, 20 Jun 2018 10:23:49 +0300 From: Jarkko Sakkinen To: Andy Lutomirski Cc: X86 ML , Platform Driver , nhorman@redhat.com, npmccallum@redhat.com, LKML , Ingo Molnar , intel-sgx-kernel-dev@lists.01.org, "H. Peter Anvin" , Darren Hart , Thomas Gleixner , andy@infradead.org Subject: Re: [intel-sgx-kernel-dev] [PATCH v11 13/13] intel_sgx: in-kernel launch enclave Message-ID: <20180620072349.GA4329@linux.intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180608171216.26521-14-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.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 10, 2018 at 10:17:13PM -0700, Andy Lutomirski wrote: > > On Jun 9, 2018, at 10:39 PM, Andy Lutomirski wrote: > > > > On Fri, Jun 8, 2018 at 10:32 AM Jarkko Sakkinen > > wrote: > >> > >> The Launch Enclave (LE) generates cryptographic launch tokens for user > >> enclaves. A launch token is used by EINIT to check whether the enclave > >> is authorized to launch or not. By having its own launch enclave, Linux > >> has full control of the enclave launch process. > >> > >> LE is wrapped into a user space proxy program that reads enclave > >> signatures outputs launch tokens. The kernel-side glue code is > >> implemented by using the user space helper framework. The IPC between > >> the LE proxy program and kernel is handled with an anonymous inode. > >> > >> The commit also adds enclave signing tool that is used by kbuild to > >> measure and sign the launch enclave. CONFIG_INTEL_SGX_SIGNING_KEY points > >> to a PEM-file for the 3072-bit RSA key that is used as the LE public key > >> pair. The default location is: > >> > >> drivers/platform/x86/intel_sgx/sgx_signing_key.pem > >> > >> If the default key does not exist kbuild will generate a random key and > >> place it to this location. KBUILD_SGX_SIGN_PIN can be used to specify > >> the passphrase for the LE public key. > > > > It seems to me that it might be more useful to just commit a key pair > > into the kernel. As far as I know, there is no security whatsoever > > gained by keeping the private key private, so why not make > > reproducible builds easier by simply fixing the key? > > Having thought about this some more, I think that you should > completely remove support for specifying a key. Provide a fixed key > pair, hard code the cache, and call it a day. If you make the key > configurable, every vendor that has any vendor keys (Debian, Ubuntu, > Fedora, Red Hat, SuSE, Clear Linux, etc) will see that config option > and set up their own key pair for no gain whatsoever. Instead, it'll > give some illusion of security and it'll slow down operations in a VM > guest due to swapping out the values of the MSRs. And, if the code to > support a locked MSR that just happens to have the right value stays > in the kernel, then we'll risk having vendors actually ship one > distro's public key hash, and that will seriously suck. > > I'm going to try to get this code working tomorrow. I'll keep you > posted on how that goes. Can you point me to the userspace bits (i.e. > something buildable that will run on a kernel with your patches > applied)? Sorry for some delay. I was on leave last week. The SDK supports my driver starting from 2.1 release: https://github.com/intel/linux-sgx SampleCode folder contains some trivial test code to run. /Jarkko