Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2880964imu; Mon, 19 Nov 2018 07:30:34 -0800 (PST) X-Google-Smtp-Source: AJdET5dUQrajQOew3VBPtrfNqfg/FK9pHoHcSuthqEBqGgXHTh9PU/O5jxnLqQ9DfPL5DFpKNLQ/ X-Received: by 2002:a63:580a:: with SMTP id m10mr11838298pgb.332.1542641434090; Mon, 19 Nov 2018 07:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542641434; cv=none; d=google.com; s=arc-20160816; b=HK5duB10kYsKxV5jRt7PmRaT8fh1tzl7WG2G8BXjrY1805gfFn99Wqp66Dkx3qgO77 ELSJg0FvwXAOVRJ0dqC465fz9FLZ0eZ1UuRTQYHm2dl4DsOhrZmKJ9L2G9YhTHv2D1fj Y8hav+86iWTDetYzsyHz1YRhlWTaZhSAIB5S3ZYuWCe67Ta/p2YqU2gIHSP4oE0cz4CU hZa0+RnVNeSYwOzXSIcIkjv2T4XG6UdQaIW5MqpwTCIaR0gQjvwKiass7GDlL2JeMTCl H/CiW5REWeSp/EWEJ5pYH5hgvmSqsh5NQgdWmxm2Q+1Ns5/eGgLCidwQvRxkmmovpQS0 /hGg== 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=u+RQUN0fyDHo1THMW3ReTMiCYeU1lQCWvCiMAqsczkg=; b=CTF43PQf6O8QJQJkMFCusNb8XByGTU+gG4yWGlmm1xgj5gSSIWutKG7ymnjXlEnsak EnlJbN4UdgdmO2jIYwCRPTqrvQYrUCmwUw1v21rgVy7zcxvSNB3sjheNEqAaUJyrM3PF 3chJJ8lEB9j/uHl2p3rQpfIVY8gfWm44+g/dphPOHXRYSlyh6lb5lv1rKPEEfR7MhVCO Dn01B4XH7FuM5uZla1HCqAa2GPZpF7uHSJRLpvaeYgl52f2JXlquUDC7Gng8M1z93m1F a5N1cpO8rp7fK3CpllpI/cp1r62U6JvSfK6TrbAWCGiIYUZ7dXLCtFS9CM38agGgWyrK Sf9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=LBE+zA4h; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si22330428pll.58.2018.11.19.07.30.18; Mon, 19 Nov 2018 07:30:34 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=LBE+zA4h; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729863AbeKTBxe (ORCPT + 99 others); Mon, 19 Nov 2018 20:53:34 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44969 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729740AbeKTBxe (ORCPT ); Mon, 19 Nov 2018 20:53:34 -0500 Received: by mail-wr1-f68.google.com with SMTP id j17-v6so32497532wrq.11 for ; Mon, 19 Nov 2018 07:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u+RQUN0fyDHo1THMW3ReTMiCYeU1lQCWvCiMAqsczkg=; b=LBE+zA4hNrUm5hZeMTnec7dMJ+6wQ+Oqz6OSVIXAH+0oWYdoPxpl7479BE03rXuQyY Yk6WFAI1D8+KXVYJQRn+ozllE2l0hb/6FuUvi5TlZV68T2lQSG0jxDk7zyKSMFpAtU4x oYc4R7ZklfvJzRjPMkNRHZJg/LI/l1Gpl8kgxFvoCYPqieROZ1Z9q8v5a6uEr/3AS6d5 fVww9j3OSeGCw+HUC5fEnSJcvBkvvGsMe7shvGkvKk3rs/4mtg7IZVJQjU7xrcSn7eXp 5SO19Tt8//SC+ZRxeLz8Zvlkyltac7TuJ1bBFjFqcizpt1I1q1nrZ6RfLwqZmGJnln3r X1Sg== 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=u+RQUN0fyDHo1THMW3ReTMiCYeU1lQCWvCiMAqsczkg=; b=VBZWALzfzuPz4odTVRhSyVsySjiMBsnsnsJNbJfkLNgeVfoVTv6fBk0m0ispqHt3R4 76f9kk9a8xFct4zd+M7eVTpXhUy/lF777EaLk0wIepjBxL4KL6EZ07+h6qOMvNZbPWOE m2OKB5QOf4i/+5+qfQFymMiG1ZWzHXZVadqJuCDj4ujur3slVzIyDKLIAtwR0Au2yaOP BTRxmikUG6di1/imtjEDaVWlwByREkBtnDH7IpsNtEY9lTTfumQouGmrLvsCuLPn7gZ9 nIIKm6z4d7gPT8I9jfs46GFmr0OHsCnalxj1ZT9j17hrIALaEjNVWbU9A4GYOz62G+pq a8eg== X-Gm-Message-State: AA+aEWYf4PCLtzuZtW001fiQv/zBoWCaY8lBBu7JUWJpTasbSHtHC9E4 OwlD6RcaaPoUlHPe5li3FzURmc8PsDO6riBmxc/xDg== X-Received: by 2002:adf:ea81:: with SMTP id s1mr205890wrm.309.1542641377018; Mon, 19 Nov 2018 07:29:37 -0800 (PST) MIME-Version: 1.0 References: <20181116010412.23967-1-jarkko.sakkinen@linux.intel.com> <20181116010412.23967-19-jarkko.sakkinen@linux.intel.com> In-Reply-To: <20181116010412.23967-19-jarkko.sakkinen@linux.intel.com> From: Andy Lutomirski Date: Mon, 19 Nov 2018 07:29:25 -0800 Message-ID: Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver To: Jarkko Sakkinen 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 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, 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. 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. --Andy