Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp2051131ybj; Wed, 6 May 2020 09:43:50 -0700 (PDT) X-Google-Smtp-Source: APiQypLsI1TPxlaZigz+uaxw6lzkitwkHXeYB4uWNesJzl1Nb0pAQ5wq3OLe7a7bMmDhhozFhl4+ X-Received: by 2002:a17:906:1443:: with SMTP id q3mr8379504ejc.325.1588783430127; Wed, 06 May 2020 09:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588783430; cv=none; d=google.com; s=arc-20160816; b=II1gQ9Hxpq5czOZ3+AExIwStWPNvZTngiX4uawXGM3OcEzFf6OEwwJt4NeEkkEbgsC pRQeMzHBFVVPSBH4CRmxpn9Hs/2l/dmN8h4WmIdjcac4YJqi67eZPujOHcElqYkucR0h pao8t0wMxelZw92ACcVvZiPhP3CtiJt1Zexul+mnt7SWKkl18EzshnMS2Lt7tSMUo2Ok T5hlZamSxTAhw/vrFo7MLpfU2UFb7tyq59qdbfgxChcAVB5tCFAvULrlMeUJFEHVzzsA QdpvLtR2MR1w0oS1PHmjWndyWqp7gKpJg2E806QKB6hjNuARPD11KeG2n0JAeX20iDuY QKVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=DYwcgcDMGuEgCCUUtRb92BG6ZazFViO8KjmvF3kSQmw=; b=aSYKxuj3ifeYiebW3yWblFJPYfOU9Sg0VghMyQPv1ueFJE+HkIyte3sG3hCf6NevJ8 Wal5MwYQe2L6vrUycwXYpMNfZn9Z21XcSeai1m5xCYSy4nxmzYCWT46rvtOxEhvHCiEO Pxzd+FcoVGo9janNKreWEQSLuHJ34dFnr+B1nT7C1GWUL6pxRHKH9PaZQ/xyC3p4w58T UML5+7XS7VFrAHXMXT6LlLwh32WGSWGuulUEkbPLZh+LLFyNhosbAhdg4wEW1l0twU32 ZBEPL4n4Dfs1OjWKNG9c6uP6JSk7bfNdn10HO5mGK4TaEuv5nKVOsayf+mj3SXU7dswK j2kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=bzxrwsOd; 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=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si1441864ejb.405.2020.05.06.09.43.27; Wed, 06 May 2020 09:43:50 -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=@linux.microsoft.com header.s=default header.b=bzxrwsOd; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729747AbgEFQj5 (ORCPT + 99 others); Wed, 6 May 2020 12:39:57 -0400 Received: from linux.microsoft.com ([13.77.154.182]:57468 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729443AbgEFQj5 (ORCPT ); Wed, 6 May 2020 12:39:57 -0400 Received: from [192.168.1.17] (unknown [76.104.235.235]) by linux.microsoft.com (Postfix) with ESMTPSA id EABA020B717B; Wed, 6 May 2020 09:39:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EABA020B717B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1588783196; bh=DYwcgcDMGuEgCCUUtRb92BG6ZazFViO8KjmvF3kSQmw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bzxrwsOdKFr/jqO/ArVI0YFE1SMjNnLdo4Ko7BOVTwB0k2KW2DBIvC2iK8fsm4Dta MPl7B9onL3dVzu3i2r0TZ85khYPx7ni3jqn8chnvhidanX9K6DxB/F0hpkgp02JsQt WQS7okicH0etFuShGeyve/eUGHBWfsAmJQDVP7CI= Subject: Re: [PATCH v29 00/20] Intel SGX foundations To: Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org Cc: akpm@linux-foundation.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com References: <20200421215316.56503-1-jarkko.sakkinen@linux.intel.com> From: Jordan Hand Message-ID: Date: Wed, 6 May 2020 09:39:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200421215316.56503-1-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/20 2:52 PM, Jarkko Sakkinen wrote: > Intel(R) 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. > > There is a new hardware unit in the processor called Memory Encryption > Engine (MEE) starting from the Skylake microacrhitecture. BIOS can define > one or many MEE regions that can hold enclave data by configuring them with > PRMRR registers. > > The MEE automatically encrypts the data leaving the processor package to > the MEE regions. The data is encrypted using a random key whose life-time > is exactly one power cycle. > > The current implementation requires that the firmware sets > IA32_SGXLEPUBKEYHASH* MSRs as writable so that ultimately the kernel can > decide what enclaves it wants run. The implementation does not create > any bottlenecks to support read-only MSRs later on. > > You can tell if your CPU supports SGX by looking into /proc/cpuinfo: > > cat /proc/cpuinfo | grep sgx > > v29: > * The selftest has been moved to selftests/sgx. Because SGX is an execution > environment of its own, it really isn't a great fit with more "standard" > x86 tests. > > The RSA key is now generated on fly and the whole signing process has > been made as part of the enclave loader instead of signing the enclave > during the compilation time. > > Finally, the enclave loader loads now the test enclave directly from its > ELF file, which means that ELF file does not need to be coverted as raw > binary during the build process. > * Version the mm_list instead of using on synchronize_mm() when adding new > entries. We hold the write lock for the mm_struct, and dup_mm() can thus > deadlock with the page reclaimer, which could hold the lock for the old > mm_struct. > * Disallow mmap(PROT_NONE) from /dev/sgx. Any mapping (e.g. anonymous) can > be used to reserve the address range. Now /dev/sgx supports only opaque > mappings to the (initialized) enclave data. > * Make the vDSO callable directly from C by preserving RBX and taking leaf > from RCX. > Tested with the Open Enclave SDK on top of Intel PSW. Specifically built the Intel PSW with changes to support /dev/sgx mapping[1] new in v29. Tested-by: Jordan Hand [1] https://github.com/intel/linux-sgx/pull/530