From patchwork Mon Apr 12 08:59:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raoul Strackx X-Patchwork-Id: 12197213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB8CC433ED for ; Mon, 12 Apr 2021 09:02:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1630D61379 for ; Mon, 12 Apr 2021 09:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239055AbhDLJCy (ORCPT ); Mon, 12 Apr 2021 05:02:54 -0400 Received: from mail-mw2nam08on2116.outbound.protection.outlook.com ([40.107.101.116]:40672 "EHLO NAM04-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239518AbhDLJAX (ORCPT ); Mon, 12 Apr 2021 05:00:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=djc6VdJ3upeiWAyXDrrcGMMoeEtQwiZ/PTVBG0ZZAgI7uwEHg2EJ1wv08Tz0fze0Vm8EOC1vQiftW4nNb1y6kpjDwCkqAe/4WYbLdHkrEy0dTOLqXOEEz920VqxauarLvOwVIViIi//Q2UfbyLoxVkqz+vuuWYsDtDdAELOdPdeAM0g5tk7+Xl8eToZKmvLKfCf1QS32FuMlCoO33wX14fINIybBfn2AsZ++lVNy5RrtdCjU20SzGUckFPOVayYphTfM/KH79bADNptgnzjmA0sOH3dK7/FPAanWTA52kSI2tCCwsYzrWUIUs7tuHQBpZ6v3IP7859yX05lItXWTgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EVSPR2JTl3t8G1eBm2Q7zlvRASyCH2iN+wcptp3nmrY=; b=NX9KH0RofwE9BLs6kQSpY6/FX4uS7GSKxiKvNd8jFjz9gy323/zS3Vly+vTCAe4I8hMSMMDU3deRDidewikVlGd/JGx5uaCvXB0PHNfIvrvRdXMD8MazuEnvDauR+U7U/oN7xeIVXLK7XzheQW24z18XRLujN2ma74b8M8/rcAXGY5LsUXpxEKoeg3v+b1iO8KE4W9dgCPZnO1wUccZxq1VhXQyjFn6ZjNAjrNT/MJMHBQhyRftHCvyKOWkTU2sk9H2/J/nqqfw52nRy0MNepm0m1VHAtIyH2DIBtvdSx6MViEqLciz1YtUefdL7FzP1Ve5y3aNm7TsFnC69MlYeqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fortanix.com; dmarc=pass action=none header.from=fortanix.com; dkim=pass header.d=fortanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fortanix.onmicrosoft.com; s=selector2-fortanix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EVSPR2JTl3t8G1eBm2Q7zlvRASyCH2iN+wcptp3nmrY=; b=BRix6E6vwV7PxvOXTRGaLUCRL3GCMzstleqUSCzOpjV/gyfClTmcd2PgU3Hdb+Ky+id2VlkA2u4dsbVXgO4k68k6ddJs8Ei0Rh7OzwhgnMGkQ5b9+XjTfCoYKgDwUESpktCD4b5kajpKemPMcODnEPKfuB5Ik+pCj81FAGZkQOw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=fortanix.com; Received: from CY4PR11MB1783.namprd11.prod.outlook.com (2603:10b6:903:11d::20) by CY4PR11MB1782.namprd11.prod.outlook.com (2603:10b6:903:11a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 09:00:03 +0000 Received: from CY4PR11MB1783.namprd11.prod.outlook.com ([fe80::f052:14fe:c2a9:5fb1]) by CY4PR11MB1783.namprd11.prod.outlook.com ([fe80::f052:14fe:c2a9:5fb1%3]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 09:00:03 +0000 From: Raoul Strackx Subject: [PATCH v2 0/3] x86/sgx: eextend ioctl To: Jarkko Sakkinen , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org Autocrypt: addr=raoul.strackx@fortanix.com; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkYyb2lmOEJFQURN UkFMT1ZjRkYyTlQva1FsWTBtVnN3YlMrYi9WNzR1azZFcDdxenpoNHpHbEtSS1pzClplS0I4 WmpFT2h5Q2pZaExwdnJHTVh2cTV1bm5pWENIbG9BR1hZRm9rN0Q0SGd2Q0djYnlTYVRMQjds NHc4MFIKOStYUkp2SnJpMEdPSmVubjRnNUpIQU5RN2h5YWl5RlRIYTVERU5CMjc2VG9kZUFQ bnVidGl1VmRDT0lnQVJVbAp1dzJHemFsbmY0WmZ1TGdEaHg5YzIza2pjZTFBQkFWbWdxUEtN TkVUSnhyZFdLQUt5QkVIWGJ0Snh6YnR4bFI1CnFUZU8yTExCU2V4TFBDbTRZOTZzRHlGK3JJ a2FpRk5JQWk2b3RrTFBxYkROUlB4OTdLTTkzcmh5dV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5RFhJ c2wKaEwxMDArdzZNTWNMeFpNVmJ4UHBTWWVHaGp4SjdNUysyeGp3eDB4MWlMNmszZk5UNHNT Q3dZa0xRZjJlKzhxYwpFYjNTa0Q0VFR3RDQxUW85SFNuUlkwdnRqblNyZkwyQ3JhVmptOXhh MXhmNlJDQ3kvaXpKNU5TQTZZMXduT0U3Ck1IOHorcVFUM1NxMld0a0NzU1M5K1U2VU9OWmFK dFN5MWNvZ1ZhMDV1QWdRY0tHT3FvcHg3QWlmZUhIUFpqZnIKakVNaHJZQ3Q5WXgzR1VET0hs MnRObDJIOStqZC9BVjByMDRKUTNxSHRWM1Z5UTNxN0N1UTlCTTdnQzVpK1JleQpHSU14Zm0v a09GWTRLRUxOeVYrV01PK2lXRHpZS21tTUxnUkVXNitqZk5jMzhrYWhaQjI2RmJOZTh6QmxU cVpPCmhxYmNZR1ZZNW9Ec004YSthbkwyZDhmaStnPT0KPW9ZT0QKLS0tLS1FTkQgUEdQIFBV QkxJQyBLRVkgQkxPQ0stLS0tLQo= Message-ID: Date: Mon, 12 Apr 2021 10:59:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Content-Language: en-US X-Originating-IP: [81.164.43.210] X-ClientProxiedBy: AM0PR04CA0029.eurprd04.prod.outlook.com (2603:10a6:208:122::42) To CY4PR11MB1783.namprd11.prod.outlook.com (2603:10b6:903:11d::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (81.164.43.210) by AM0PR04CA0029.eurprd04.prod.outlook.com (2603:10a6:208:122::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 09:00:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd0c9b0a-f446-4628-f0ba-08d8fd915bf7 X-MS-TrafficTypeDiagnostic: CY4PR11MB1782: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4qP5GB2fqb0ot3YDXjq1Vl2XUozbei2selT6LO3O4+cTY4n2FVOak36cobnp9660Xup2277O28uMGoAOg7Nq/DVq9bXex7N3H2dGZkxWfM1cgb+z9IKuImrwCn0uFikCKv1QPHudJcXu1pfiIToGbof71DxP7IC/qMsX4YE27NndQqefHFFtzIhOUdP/QcwIONLgMYyy7mRriAg36wcMWAFH3WcxToN36g0AquoYdlxaBPRilxj1nPICtSng1fPDNLdhK1bLWdMCjyylgYnF+g5Iqw61iKlw5wVvFUUnLTAueRiNa0mpj1Pv2sH8ZFfdsWWxT8275VIIV357xr6d5HxSLBouX9dLHwnIRA7oXPartbquNoBnAfIzSe9OZZReyVQzCnRETNMopQC29ihBH2Qhf4tIbD+cWLloQl2/5P8rdrpbQckloeAbWdSBim2Xw5NG5KQs59/2R+ymJhNeeYmMoEOG+RCDuA5zG4zmecIlT1h44izY9tIifWUmz0CNXB//gHqws5FJ7J0pc9wYa6fHnbGpd0lK+B9vG0qUIwUIDxB6LXgy53n1T/nQGEg9e3ngoSifvfqYtR/K2fn8WLvDOUDwPXRZwuITHFVaTMFbJIYVTXWWgqBVafnqQH/pWa+PzfJ1OMnbfyppM7TCdV7bzkXLzYNgRIt5ewkclRnsGXXzBdLhloKjWmqWBH4lDjvv1Kyuy8TyMuZZw2xBHLr40vE9HUhRpCPEKZ5t70+DOdCp/zfrA68irDlxu7b6q0txYWmavH+5skvLblMVk8J7dpuCXYb/Hp3ROjpTou0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1783.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(376002)(136003)(39830400003)(366004)(38100700002)(38350700002)(5660300002)(8936002)(8676002)(6486002)(16526019)(6666004)(2906002)(186003)(26005)(44832011)(66476007)(110136005)(16576012)(478600001)(52116002)(66556008)(31696002)(86362001)(66946007)(956004)(316002)(83380400001)(2616005)(36756003)(966005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?UjicQLaqCQreXvY9g3yay/699Netgc?= =?utf-8?q?RpTsjJ5/ctUsvNuGQ+GVT4x0IT7f8TB8cLwpREwkOWhyf5ypHje+npDI2SwXSCZDJ?= =?utf-8?q?OOUmxEVnFryoFC040/t+0WvfF9R+OKfrnetTbBVdey38wVOAHKN4zEVaQF2HVgZod?= =?utf-8?q?NRr/tCObnhvqZxoNF5JhfoC3puOij9VAhLVBEDUC383hu3NPCWdKD1uFXhjHBrHD+?= =?utf-8?q?gdtwtzPA1Yh4ohctOvcBog4DHcWzUk0OL8Z86crI+c7oLkfcoiH++rt0SaHjVkqLB?= =?utf-8?q?Po/0MhT1CUqEOSBgwWfX7I3klR7ChjFeLiENL4GXAu6iJygoQ+YPGtuVPTWhlQN9j?= =?utf-8?q?uyaBlJTsCm1XUBUbzBiGfDl2YN1vvGG6lwA27spBeAo9OOjZmV6yhHx6f+GB7dWyC?= =?utf-8?q?Nb/zce3unCHByjJJM/Ywe3aHpI/BHFcXuH6MOmlvA/nXpv8+Ns4Y9Q/z5UD/uyEFW?= =?utf-8?q?h5uF+wplgFaIM1qrmR98gX3XmELndK3IPIOTIzAoHpNAiUjaScMuu9Pv12v2o+1ug?= =?utf-8?q?6788FmqysQA+Bgg/6G80gDuaa0PCTwxAU3nrOmWpwuLi+0oWQWmfDnZwSrBBD2Xnv?= =?utf-8?q?tz0624cVNNZx/rJO5+FG5REnHGBncV+VRGHW7ZEf1t6EuxBWF8BAqn7A8kc7HL/we?= =?utf-8?q?gokmZi+A4HUiup4mM+CAMpJfN1uzs90uger4QFMAIeOz8xaE/CONiz6iVfVuCvTCW?= =?utf-8?q?oz0oIU9GIrG62P8XodePfkpABxxZzUgWU0zHKYOBn7HVIPD61JJestL0wiJIIsrm3?= =?utf-8?q?LMDslfk+XDjEYWfBLiqV8ya0TRe9l/yw1KarOvNhKs8ldbcYypz3B45wUe280oPiM?= =?utf-8?q?4QR9LuWCj7fQEqX0tBIcsxL5mNLxXJ/KBzQ2Wj8fNoDURoAJ77LC7rbuuTEuApfXG?= =?utf-8?q?lPWkkT5RaclDTYM18Op3OCRBlLthkJZa10Tm9IXvEYXQkH6wAaFN0uHF+OtYfV/Fo?= =?utf-8?q?BCLix49BqgXZ+zEQ2xhzcu4K7UfXN7RWSK9y7CLR3L5dX4GRkdYg+fjzdyk/09DHw?= =?utf-8?q?pCieAN1R2cvsBzw2m0jGlTtEYhmz8n+XhwCNLvTy7bfU4t3X3DWxWcBnt1nnKpgQm?= =?utf-8?q?dVH/Dl0Gmrxfrlhgl5FDYAcckLv0nOpwzq5bdc61OEqH9I+zLVvXiUpOfZvIxsr8T?= =?utf-8?q?1atWOZQ8rPmMpmwjw7VhQKoxzz6aFAj8M70ul/NApBC1A8Kzk0iQ2P+7Hw5m06/49?= =?utf-8?q?eUeoVjwR70BFsT5/puqcMHqkdx54bEsrYIgJ18KpJ95Z15OQcor1WWmGv9rwa4FSn?= =?utf-8?q?mvfya31/h8eZe4?= X-OriginatorOrg: fortanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd0c9b0a-f446-4628-f0ba-08d8fd915bf7 X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1783.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 09:00:03.1734 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: de7becae-4883-43e8-82c7-7dbdbb988ae6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nQ3qJYGImkhvoq3HsGcHSm2r0BJNDdIRBAczng7E9AgMS0ZxAe5/BmJm4Rbe8DSEYSNDbUaOrCrRSwJ4gP6EuATzf7eYS5RugDjExTG1Xgk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1782 Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org Creation of an SGX enclave consists of three steps. First, a new enclave environment is created by the ECREATE leaf function. Some enclave settings are specified at this step by passing an SGX Enclave Control Structure (SECS) that contains the enclave MRENCLAVE, MRSIGNER, etc. This instruction also starts a cryptographic log of the enclave being built. (This log should eventually result in the MRENCLAVE.) Second, pages are added to the enclave. The EADD leaf function copies 4KB data to an empty EPC page. The cryptographic log records (among other properties) the location and access rights of the page being added. It _does not_ include an entry of the page content. When the enclave writer wishes to ensure the content of (a part of) the enclave page as well, she must use the EEXTEND leaf function. Extending the enclave cryptographic log can only be done per 256 bytes. Extending the log with a full 4K page thus requires 16 invocations of the EEXTEND leaf function. It is however up to the enclave developer to decide if and how enclave memory is added to the cryptographic log. EEXTEND functions may be issued only for relevant parts of an enclave page, may happen only after all pages have been added, and so on. Finally, the enclave is finalized by the EINIT leaf function. Any new invocations of the EADD or EEXTEND leaf functions will result in a fault. With EINIT a number of checks are performed as well. The cryptographic hash of the final cryptographic log is compared to the MRENCLAVE field of the SECS structure passed to the ECREATE leaf function (see step one). The signature (MRSIGNER) over this MRENCLAVE is verified as well. When all checks pass, the enclave loading is complete and it enters the executable state. The SGX driver currently only supports extending the cryptographic log as part of the EADD leaf function and _must_ cover complete 4K pages. Enclaves not constructed within these constraints, currently cannot be loaded on the Linux platform. Trying to do so will result in a different cryptographic log; the MRENCLAVE specified at enclave creation time will not match the cryptographic log kept by the processor and EINIT will fail. This poses practical problems: - The current driver does not fully support all possible SGXv1 enclaves. It creates a separation between enclaves that run everywhere and enclaves that run everywhere, except on Linux. This includes enclaves already in use on other systems today. - It limits optimizations loaders are able to perform. For example, by only measuring relevant parts of enclave pages, load time can be minimized. This patch set adds a new ioctl to enable userspace to execute EEXTEND leaf functions per 256 bytes of enclave memory. With this patch in place, Linux will be able to build all valid SGXv1 enclaves. See additional discussion at: https://lore.kernel.org/linux-sgx/20200220221038.GA26618@linux.intel.com/ T/#m93597f53d354201e72e26d93a968f167fcdf5930 Raoul Strackx (3): x86/sgx: Adding eextend ioctl x86/sgx: Fix compatibility issue with OPENSSL < 1.1.0 x86/sgx: eextend ioctl selftest arch/x86/include/uapi/asm/sgx.h | 11 +++++ arch/x86/kernel/cpu/sgx/ioctl.c | 81 ++++++++++++++++++++++++++++----- tools/testing/selftests/sgx/defines.h | 1 + tools/testing/selftests/sgx/load.c | 57 +++++++++++++++++++---- tools/testing/selftests/sgx/main.h | 1 + tools/testing/selftests/sgx/sigstruct.c | 43 ++++++++--------- 6 files changed, 154 insertions(+), 40 deletions(-)