Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp765000ybk; Fri, 15 May 2020 12:57:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8mQi4zCAlDxRtLSUpH4QQrY78VsWyg4dOnQ3hqonp45mqPvieZ3fZM//kuuhtfwHXtcfv X-Received: by 2002:a05:6402:c84:: with SMTP id cm4mr4265100edb.316.1589572623006; Fri, 15 May 2020 12:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589572622; cv=none; d=google.com; s=arc-20160816; b=tMObyAv3KQ4fdZ8DgLjEx4F+95kpEhiZE6v0OuzLEoJL0Bs8M/GA08YBszAxq5bYiC MYegv7SlUkzOldEO5Bf47LGo/z7ktKUu28mdFjpP32tL+q8IMFc1A1bCpal8BJ6LtuDI 7OjYZmj7wnTTTiWXSXQbYm/Qvcz5s+MqEq486m4RB2/3ikOpCq1JTT022BOBtUBArrt/ DPbEdF3bKcYHXJ5/xB4eHL3OVP1wlFPBwzcuadFqx1MnKk9Ps143xq95mKY45o5W/kWX ogaL+U5QauVuHcTEhuiGfCjpOPcbddq2BL/3cNk319IEG2SfcF17Mu6v6ckb2LRJ4zIr 1qbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iQptZ1WJz6XqQM2Mwc/yY9NqQTOh8PTaYoHOYTOng5k=; b=jvK70iAPWVhr8wQzjIma8X1rTcHeNtHK/gyPdf/YvUOVM2hH9B95kLd6RxB0VG8au7 faMBxrCI4Ok2G84Ehv/b/Vu2q1EcIAcXPb9zp9nTLPyQvqvbgyy0ljSZ46QqdXz+LRja cMNPDPQQ+JbdiM839I2kmGmrxjtU3u4EavNgsZi/iTkd6gY2S72IP2bNdPxzu6oQtiPn 91pVjEczgXQS7/6dmCwT6aBaEV3rH8+XvdC/oaHUJ36C99DQNBVypYvBX5eC3dl92J/q qVsNh7TscCBNDqmTs812kWCtvb2cxQKPmolt/71rRDSMbgMIFVxzpxULTSBBf76ooKnp pBlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ER76UtRQ; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si1983606edc.572.2020.05.15.12.56.39; Fri, 15 May 2020 12:57:02 -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=@redhat.com header.s=mimecast20190719 header.b=ER76UtRQ; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726297AbgEOTzB (ORCPT + 99 others); Fri, 15 May 2020 15:55:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33122 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726226AbgEOTzB (ORCPT ); Fri, 15 May 2020 15:55:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589572499; 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: in-reply-to:in-reply-to:references:references; bh=iQptZ1WJz6XqQM2Mwc/yY9NqQTOh8PTaYoHOYTOng5k=; b=ER76UtRQzhyxB1d2R6V6rAE3Ave0OGiQQcHnbFsHODi2uo+LUgxN+kRNPburT/UJyUVbCy J9Aeac9VUJNo+pHJFQ46QWBRMzW/FcDM8EUK4GcaGvUozuEoQLkmMPqZP4bOFVdmKIwOP2 Y4XwzIyBiY4gpibH84F0UBNZtpGxPFc= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-dhJEb8LJOvalbbQDXbKFkA-1; Fri, 15 May 2020 15:54:54 -0400 X-MC-Unique: dhJEb8LJOvalbbQDXbKFkA-1 Received: by mail-il1-f198.google.com with SMTP id u11so3146556ilg.5 for ; Fri, 15 May 2020 12:54:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iQptZ1WJz6XqQM2Mwc/yY9NqQTOh8PTaYoHOYTOng5k=; b=h3VZjTE1r27f5L8+ukX3cGTEscX4Aw7EtLpCv8/CDMSguzNfsXojMdIVHV9AokLBYq m+AuSZ2YbR1kKriPTxYuV2+6OfZhGEkFAQoKzlAD6l43fnXZcuvab96wy7u/YIrkqXzx fkjfsr8B9INxQnlEYOSM/fglOkj37rCFYxs0i9rYiufHljoGgE3szucuxndYbAsCJmaw mY/tnP9utqVNp1sGPemhXRvM9GbXG6Vvzn9yT9q9ORnNhg+4uYen/nepicC7fUKemamt yrEmdw0FIJ2loUyFnh7btDEBOQhqZ9U/KndZJPBpIwv5kzCqveXrwDlTYs9SapGXjQUs nnaQ== X-Gm-Message-State: AOAM532kf5Fg+/XxM+cuCimVu/ySJxj62oCUahy15sT4K5qZiPqaci+i WMK8TNCDTC5/mScKNbyQOL94PFd708EFwmiFLWBANgJM09DNr3W/zvniCVmUI4ZmWgjZo2UaeAO qYk2U8FBDgF5/aDAaCgMXKWDMqyC315CU5AgWgv/a X-Received: by 2002:a05:6e02:1051:: with SMTP id p17mr5175267ilj.86.1589572492214; Fri, 15 May 2020 12:54:52 -0700 (PDT) X-Received: by 2002:a05:6e02:1051:: with SMTP id p17mr5175228ilj.86.1589572491727; Fri, 15 May 2020 12:54:51 -0700 (PDT) MIME-Version: 1.0 References: <20200421215316.56503-1-jarkko.sakkinen@linux.intel.com> <20200426165753.GA11046@wind.enjellic.com> <87d07gk24l.fsf@nanos.tec.linutronix.de> <20200508190226.GA31465@wind.enjellic.com> <20200508195635.GR27052@linux.intel.com> <20200514091637.GA25156@wind.enjellic.com> In-Reply-To: <20200514091637.GA25156@wind.enjellic.com> From: Nathaniel McCallum Date: Fri, 15 May 2020 15:54:40 -0400 Message-ID: Subject: Re: [PATCH v29 00/20] Intel SGX foundations To: "Dr. Greg" Cc: Sean Christopherson , Thomas Gleixner , Jarkko Sakkinen , torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, Neil Horman , "Huang, Haitao" , andriy.shevchenko@linux.intel.com, "Svahn, Kai" , bp@alien8.de, Josh Triplett , luto@kernel.org, kai.huang@intel.com, David Rientjes , "Xing, Cedric" , Patrick Uiterwijk Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 14, 2020 at 5:17 AM Dr. Greg wrote: > > On Fri, May 08, 2020 at 12:56:35PM -0700, Sean Christopherson wrote: > > Good morning, I hope the week is proceeding well for everyone. > > > On Fri, May 08, 2020 at 02:02:26PM -0500, Dr. Greg wrote: > > > On Thu, May 07, 2020 at 02:41:30AM +0200, Thomas Gleixner wrote: > > > > The diffstat of your patch is irrelevant. What's relevant is the > > > > fact that it is completely unreviewed and that it creates yet > > > > another user space visible ABI with a noticable lack of > > > > documentation. > > > > ... > > > > > As to lack of review, we would certainly welcome technical and API > > > comments but we cannot force them. > > > Thomas' point isn't that your code needs to be reviewed, it's that > > trying to squeeze it into the initial merge will, not might, _will_ > > push out the acceptance of SGX. The same is true for other features > > we have lined up, e.g. KVM and cgroup support. It's not a slight on > > your code, it's just reality at this point. > > For the record and for whatever it is worth at this point. The patch > has been available in its present form and function for around 14 > months. > > So there was plenty of time for its consideration and integration into > what is being prepared as the final merge candidate. > > > > In fact, anyone who reviews the patch will see that the current driver > > > creates a pointer in the ioctl call to pass downward into the hardware > > > initialization routines. Our code simply replaces that pointer with > > > one supplied by userspace. > > > Personally, I'm in favor of adding a reserved placeholder for a > > token so as to avoid adding a second ioctl() in the event that > > something gets upstreamed that wants the token. Ditto for a file > > descriptor for the backing store in sgx_enclave_create. > > That would be a very low cost and forward looking addition. > > > > At the very least a modular form of the driver should be > > > considered that would allow alternate implementations. Sean > > > indicated that there was a 'kludgy' approach that would allow an > > > alternate modular implementation alongside the in-kernel driver. > > > I believe that Andy has already indicated that may not be an > > > advisable approach. > > > Modularizing the the driver does nothing for your use case. The > > "driver" is a relatively lightweight wrapper, removing that is akin > > to making /dev/sgx/enclave inaccessible, i.e. it doesn't make the > > EPC tracking and core code go away. Modularizing the whole thing is > > flat out not an option, as doing so is not compatible with an EPC > > cgroup and adds unnecessary complexity to KVM enabling, both of > > which are highly desired features by pretty much everyone that plans > > on using SGX. > > All well taken technical points, but they don't speak directly to the > issue at hand. The potential security issue in all of this is access > to /dev/sgx/enclave, not the EPC tracking and core code. > > Here in a nutshell is the paradox the kernel faces: > > No one seems to be disputing the fact that the primary focus of this > driver will be to support the notion of 'runtime encryption' and > Confidential Computing. The whole premise of the concept and economic > predicate of the initiative is that the owner/manager of the platform > has no visibility into what is being done on the platform. > > If the Linux community believes that standard platform security > controls can make qualitatively good judgements on what enclave based > execution is doing, it is effectively making the statement that the > very concept of runtime encryption and by extension Confidential > Computing is invalid. > > If we accept the concept that Confidential Computing is valid then we > admit the technology provides the opportunity for unsupervised code > execution and data manipulation. > > Our premise in all of this is that one page of code implementing three > linked lists is a small price to pay to provide platform owners with > the opportunity to optionally implement what is effectively 2-factor > authentication over this process. > > Going forward, if we are intellectually honest, all of this suggests > that adding complexity to the driver with LSM controls makes little > sense technically. Since, by definition and economic intent, the > technology provides tools and infrastructure that allows these > controls to be evaded. > > The notion that entities with adversarial intent would not try and > take advantage of this flies in the face of everything we know about > security. > > > Andy is right to caution against playing games to squish in-kernel > > things, but the virtualization snafu is a completely different > > beast. E.g. SGX doesn't require fiddling with CR4, won't corrupt > > random memory across kexec(), doesn't block INIT, etc... And I'm > > not advocating long-term shenanigans, I just wanted to point out > > that there are options for running out-of-tree drivers in the short > > term, e.g. until proper policy controls land upstream. > > It appears that the distributions, at least IBM/RHEL, are going to > compile this driver in and backport it as well. The (Red Hat sponsored) Enarx project will continue building an unofficial, unsupported version of the Fedora kernel with the SGX patches[0] until such time as the patches are upstream. Once upstream, I intend to propose that the feature be enabled in the stock Fedora kernel. Enarx requires EDMM support as a prerequisite to being production ready. Therefore, we are likely to continue building this custom Fedora kernel with the latest patches until such point as EDMM support lands upstream. This also implies that I have no current plan to request an SGX backport to a RHEL kernel until such time as it supports our full needs. Disclaimer: I do not control RHEL or Fedora kernel features. None of the above constitutes a commitment to deliver anything. [0]: https://copr.fedorainfracloud.org/coprs/npmccallum/enarx/package/kernel/ > What we would recommend at this point is that you and Jarkko do the > Linux community and beyond a favor and wire up a simple kernel > command-line parameter that controls the ability of the driver to be > used, ie. enables/disables access to /dev/sgx/enclave. > > Distributions or others can set this command-line parameter by default > to 'disable' and avoid any possibility of the technology being used > for nefarious purposes. Since the technology now appears to be > focused only on the cloud providers they will certainly be capable of > configuring their implementations to change the default. > > In essence, make the kernel's behavior secure by default. > > Best wishes for a pleasant weekend to everyone. > > Dr. Greg > > As always, > Dr. Greg Wettstein, Ph.D, Worker Artisans in autonomously > Enjellic Systems Development, LLC self-defensive IOT platforms > 4206 N. 19th Ave. and edge devices. > Fargo, ND 58102 > PH: 701-281-1686 EMAIL: greg@enjellic.com > ------------------------------------------------------------------------------ > "Intellectuals solve problems; geniuses prevent them." > -- Albert Einstein >