Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1202024ybj; Thu, 7 May 2020 17:42:14 -0700 (PDT) X-Google-Smtp-Source: APiQypIcbmilWkq/Ia+I00s77FD2kmQJ/oaPbDisjlWv+CTeG4hdiqB38Vi0DfGOPAEtpS3M8ORo X-Received: by 2002:a17:906:468c:: with SMTP id a12mr14932136ejr.149.1588898534153; Thu, 07 May 2020 17:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588898534; cv=none; d=google.com; s=arc-20160816; b=W463CRoFqvjwuYOLIrpjAUnJFKnzeSOIsfR+dCm0SnRPAdAubUdy5rNJsYFEDruD0g lN1oOXcMrY0wZt+cND91ng0bDwaioxq2YQtBTB3LSvDFwSDhtF5fyt2Xxqanc/WzPY3f NRg1MPj75kAlxs6gMIYmGV0z++zuES4xrvE94iUYZ5qGK51BDYv/5OGPmvF8vx4zRM+t 1nQER5hlUBTmBHb5Q/KVynpos8JE9A1EBs4HoxpLORTP5T0dD5YVqxXAfCyiWPKBDs2q 6srbKT+Z7vxVOklzqCH9nUKPsVHi+y7KfDlbVL14t5Z9K5a2I4xe+GO5VDDLa34N4M3D y6eg== 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=TBoLcdBqgw/u/c1uvM/rrc7k+Kcs5BQ0ACm9HOYNRVM=; b=sY06ahLhGV5Qcmd2GjPrOMIIUoNkOqodFlcmMItyuHKgsm6m0WYf483y9J9pHIbkW1 +Ych/wCKzQZ8qYbTKHwt505lIOgbyGPSxxI2+cXvG8mmWmeiBbDqzVYJwfihCmApG2Q4 Apf9SQT61SVVExx+G/OemTrLPIl4st2or3Xpvy6rqPU5bJ0gpzw0i3PP/ZVGDak4VrCP hDk2G4qQ4/MFUN3jN6FE6Qia1fLoLcJkpAGNJqtUzn8XkwHSsJrYga8ZMkAFRv7S2F3b VqtZRX8R9jWqDV8gm0l1q8pWILNLwMrKxefCQZN0L+x0mDV+W7J+WHuPE4aCsNnig2oM g0Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CmJN7cvk; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si49382edv.44.2020.05.07.17.41.50; Thu, 07 May 2020 17:42:14 -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=@kernel.org header.s=default header.b=CmJN7cvk; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbgEHAk1 (ORCPT + 99 others); Thu, 7 May 2020 20:40:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:52612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgEHAk0 (ORCPT ); Thu, 7 May 2020 20:40:26 -0400 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C664B21841 for ; Fri, 8 May 2020 00:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588898426; bh=6DvqviWnsP5o86+PhIomjPeqp2M6x7IJfqoZNaxxcDg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CmJN7cvkpT6h2/Ygm8zn3kkmnMlgnIgznuN13Yeyn989fiekb7Ss6tvUF5j7N6jVd LbFZwA4Hh2PJoy09qNNCbIknr9pZjgzWvmSW9w1nDFxqBhbBr6ckKpPbrAHFLEvoUe XyjhCjnRU4ZfX3u6MzPPKDIxPbevbWERiv4D+qas= Received: by mail-wm1-f44.google.com with SMTP id u127so8848751wmg.1 for ; Thu, 07 May 2020 17:40:25 -0700 (PDT) X-Gm-Message-State: AGi0PuY8qr3anib6yQ+uE/syTP9qki6Z2rBzuv0nJr7NyWpO0DHDP+Lr dHKkvkn9tlJjVuQGs7bCWVeL8WwEpkPuPzuLbc/yyQ== X-Received: by 2002:a7b:c5d3:: with SMTP id n19mr6049575wmk.21.1588898424128; Thu, 07 May 2020 17:40:24 -0700 (PDT) MIME-Version: 1.0 References: <20200421215316.56503-1-jarkko.sakkinen@linux.intel.com> <20200426165753.GA11046@wind.enjellic.com> <20200429153004.GD15992@linux.intel.com> In-Reply-To: <20200429153004.GD15992@linux.intel.com> From: Andy Lutomirski Date: Thu, 7 May 2020 17:40:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v29 00/20] Intel SGX foundations To: Sean Christopherson Cc: "Dr. Greg" , Jarkko Sakkinen , Linus Torvalds , LKML , X86 ML , linux-sgx@vger.kernel.org, Andrew Morton , Dave Hansen , Neil Horman , npmccallum@redhat.com, "Huang, Haitao" , Andy Shevchenko , Thomas Gleixner , "Svahn, Kai" , Borislav Petkov , Josh Triplett , Andrew Lutomirski , "Huang, Kai" , David Rientjes , "Xing, Cedric" , puiterwijk@redhat.com 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 Wed, Apr 29, 2020 at 8:30 AM Sean Christopherson wrote: > > On Sun, Apr 26, 2020 at 11:57:53AM -0500, Dr. Greg wrote: > > In closing, it is important to note that the proposed SGX driver is > > not available as a module. This effectively excludes any alternative > > implementations of the driver without replacement of the kernel at > > large. > > No it doesn't. The SGX subsytem won't allocate EPC pages unless userspace > creates an enclave, i.e. preventing unprivileged userspace from accessing > /dev/sgx/enclave will allow loading an alternative out-of-tree SGX module. > Yes, SGX sanitizes the EPC on boot, but that's arguably a good thing for > out-of-tree modules. > > And if you want to get crafty and squash in-kernel SGX altogether, boot > with "clearcpuid=" and/or "clearcpuid=" to disable in-kernel > support entirely. SGX won't be correctly enumerated in /proc/cpuinfo > relative to the existence of an out-of-tree module, but that seems like a > very minor issue if you're running with a completely different SGX driver. > > > It also means that any platform, with SGX hardware support, > > running a kernel with this driver, has the potential for the > > security/privacy issues noted above. > > Unless I'm mistaken, /dev/sgx is root-only by default. There are far > scarier mechanisms available to root for hosing the system. > > > If key based policy management is not allowed, then the driver needs > > to be re-architected to have modular support so that alternative > > implementations or the absence of any driver support are at least > > tenable. > > As above, using an alternative implementation is teneble, albeit a bit > kludgy. It is worth noting that, if someone actualy does this, and a future kernel patch breaks it, the upstream developers are unlikely to apologize or even feel particularly bad. See, for example, the current situation with VirtualBox.