From patchwork Mon Jul 17 21:10:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9846239 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62EA960392 for ; Mon, 17 Jul 2017 21:21:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A534265B9 for ; Mon, 17 Jul 2017 21:21:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E8A227F81; Mon, 17 Jul 2017 21:21:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EADB0265B9 for ; Mon, 17 Jul 2017 21:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbdGQVVG (ORCPT ); Mon, 17 Jul 2017 17:21:06 -0400 Received: from mail-bn3nam01on0076.outbound.protection.outlook.com ([104.47.33.76]:46539 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751943AbdGQVMG (ORCPT ); Mon, 17 Jul 2017 17:12:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QZynvuA8ZNzuN07kFf9fTnkCxerwTvHKLgrvIRdoBzA=; b=BxATW48TrFEL7V2cEt+5Yhl7uG5ahUvwzuoMcQQQgwdEP0sdXRZ6V5jtps9FRTJCmM2gyMtuaGJ+KjgDD3lA+qhbQ3zioYwkuQmJAVRAgiFo6YkkKB5GqrznppqPi07r/awdfcmhAJEmtN2OAUZHyjOMUarH+fQhW/EQUkWRytI= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=amd.com; Received: from tlendack-t1.amdoffice.net (165.204.77.1) by MWHPR12MB1151.namprd12.prod.outlook.com (10.169.204.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.13; Mon, 17 Jul 2017 21:11:53 +0000 From: Tom Lendacky To: x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kasan-dev@googlegroups.com Cc: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Konrad Rzeszutek Wilk , Andrey Ryabinin , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , Paolo Bonzini , Alexander Potapenko , Thomas Gleixner , Dmitry Vyukov , Rik van Riel , Larry Woodman , Dave Young , Toshimitsu Kani , "Michael S. Tsirkin" , Brijesh Singh Subject: [PATCH v10 18/38] x86/efi: Update EFI pagetable creation to work with SME Date: Mon, 17 Jul 2017 16:10:15 -0500 Message-Id: <9a8f4c502db4a84b09e2f0a1555bb75aa8b69785.1500319216.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR03CA0008.namprd03.prod.outlook.com (10.168.230.146) To MWHPR12MB1151.namprd12.prod.outlook.com (10.169.204.15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 116ea562-c99f-41a7-0583-08d4cd587521 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:MWHPR12MB1151; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 3:Pm1I+XjlfkFPjY5C9oYAHutujKRyzQZj3GkJFFnoDZsJjRb+Y4bDT3DnIFKYNtgqAfT5utSQrvCzELU/cJlc5CTcxm7aX3dbIvMQVpKQSUiMCpwhzrUU4AqmW4pJJVjLzEbhODHT7TSfMxRlGrqZbhwoGAcBA0KuvxaGkUQIx4UtL0V61823CTBhDDSsj+Fd0z1H1LEH28xjlBrA0oH9K8KIjudSr2IUeXPXJfaGZSVc59ZXu1eL5rRcm4AHlGFXPBbeE9+YBY8OXZl3dT8uspaCbJJs8mWGnyzk4tF6p6dVT4Th68udcJn5ZDIlID96UGKeyeCC4l0TG9Y/8nLWELNEwXlDosJGi9OXJvMyzcDvhpKaqJcko6bj0c2bcnBQ6XpaVeuT+iU1fpuH8nPgPpxAmEjsGMzpCndz74M5j/5GoHYB2NgTVYX06VF/BlvrXzoAWrLQwfyufOgg9/LbQRLu4HZXBK9RDhOeiRAq51H1bTWUEUknP3uDZGaYGn0ZIAbpcLdHd0NLCZNbx1TS+3WuhiR/uRD3DGNPfZN2eA9spNrwCP5/PBBhAzpd4if6OqdSr5X0DKK7tZD1/t374XY5I0g/V8Pivu4Px81iHNkprt/cR97UTobijcgmGnjLg+cFvVNZQxp05rS9jYVJC/f/uuqLlJ+v0ePscRX+O4xj8Qww2YfIjjdd8hnEzYxPPBx0ZyL8lIMebFf4PhVKFnwBDqDr91pEQzbY3VGabnHorFY5lTJENhMePGkPWXhzmp5tvkryyE6PWSR31M6BgA== X-MS-TrafficTypeDiagnostic: MWHPR12MB1151: X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 25:rydXe1Pt6lMHyd9wCX7cubkXmua1XoSmqgmjJ0ReRrszcwiPPG7No6HnAaK95hbjXfcQgDzVXJ2rEQ+ZxemH3H6JTUUYABhK8c1K+mczTqzWVU3C8o84PoI5jo8voLRcccyWYjDPzSM8A6Dvp7M0it7LJJRn3snM85gYoIiJqDevH3ZRrLB2mj1uBPGFRzWROIpGxm/m+pdjfXOUJosOF1//4a12L5XEGYg+e7biWdIOqomxxNnkU+3GGMsDsnX+BE5fNnHW45HPrgYBeEZD5o2Eafl6FN6LV7Ei8HXpmM6hmg8uRtjmFG3VGaCTsv2JfvEx/VUpgycJpobpcTOsPCvI8DBNyDx7q+JAEEq7Zi/TBxC7bqCF8KBrmujyENtGdeG4NClXBtKdysror+HTFTXAAycmq88alJqF9/CGS9AayojKqmIttAGsqtJYBkcRlSarEj8N0A2GEKUqjndkYHE7E3A9kinP9CCImSFfPariPDem2V/aGc3DXFzIDrijD6Sht2V5pqrWqvS0N6KHglPZN8NHz8dtt5kNdsuf8ZWwuwq4YvaTuj02E0Dk3xeM/d8wrqev7PrNBnaP1F/zntFlwtN+T0Y5KyCB5etMStU91yMGpuHYTD/bEHEj57xjpUmhfcp39VPht+SnGvs3P3ZZ9jSlpLY1UUBcUgrpK2BQQJjDPUURpY+Mudadcwm5eZ9nBcJcXeiHwT5w21pFLLPJJBEoR3RKs7JPWUCxfJ9iGYfqjj8fc6xldm3sJ8k6DuF0d2mA5DtFutIdQcNQCpKzNc9zFoA+JcIwbFR+a5LsIG6okGOaJFnTJlhKqkJTXVqdeADmZCOPvWWvzwmKLzpznCB17SaqvGVNQwLu8THOOV/b9uJwQLGAhuH70hNHVzZZKIGO6+NPq696l57VZ3SvnNqrLP97l9KFHXFDw N8= X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 31:VLXHF1F8rz5Ms1ZkhYRr/XWX91Fxef8pdynCJ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9jh8nwa9sD7YkGco1JxqK4+5C10tSkjMPSDZ8wwnOImN0z5LMX5WMyJ7hd6JGGIOekjiYzbFClsf1gg1M1wQ9JO/TxlzUPRb+QyNdbyytJmejh/UBrCvb4EJw24E X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110)(148574349560750)(167848164394848); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910075)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR12MB1151; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR12MB1151; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1151; 4:bL6KkGe75T666AP0XEt9iasWZfaYmKhUCNGcWQ5Hxs?= =?us-ascii?Q?QsQZTDanJzS1y1kXU7pB8LrUp+DoWC4wkTcggbsX+tcJ/Ju8pBywMx8L8ayA?= =?us-ascii?Q?sCI8FKh+thD87EmVInDgXXMy9gleinYMtv6QsPkAbAa7KGOZzLlNfP176bI5?= =?us-ascii?Q?7Zl2lLB9KSrS05lekXsdCWe4bZ6zCc1MHdbCqqzWTS7x3E45/k1nd13Z3hTs?= =?us-ascii?Q?BxZQrH1rZt3qX7Of2n310cZVuSMkOyE/eu5XFiHi9MnwmlbStOZFeFHgxWk4?= =?us-ascii?Q?nFo8/Y7Jn5ERHQmnUa8I4iG0Lyq8ikmYL/h8zJ3TgziJgHUajtUYqisDjI+p?= =?us-ascii?Q?U4pU8lfOdzSWRS+BD2rT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?= =?us-ascii?Q?+1ba4IR9XKgwA3BvgGiaIdreFxvfpRXBNwQujXTHEqMfv6+Kn6cU1fF251aA?= =?us-ascii?Q?8NzwzR9hqZsUlxdRUrKb9b/CNirGPkfabl1mmxqsFr?= X-Forefront-PRVS: 0371762FE7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39410400002)(39850400002)(39840400002)(39860400002)(39400400002)(39450400003)(25786009)(6506006)(33646002)(54906002)(7416002)(76176999)(478600001)(8676002)(50986999)(6486002)(47776003)(5660300001)(189998001)(42186005)(38730400002)(305945005)(72206003)(53416004)(66066001)(50466002)(48376002)(110136004)(118296001)(15650500001)(2950100002)(81166006)(5003940100001)(3846002)(6666003)(36756003)(53936002)(7350300001)(6512007)(2906002)(7736002)(6116002)(86362001)(4326008)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1151; H:tlendack-t1.amdoffice.net; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1151; 23:lqEMdDVJf3wr5Ba82kvWqToC74I6Izv1JOLBbB1wj?= =?us-ascii?Q?NuczGt65gQjKmtC0M+Uh27ThbUJEt11KE0yfF4p+07nGoRbHB472NYNk+KuK?= =?us-ascii?Q?x3rWKVgduupQ0e95obm19IiDf2SlTjW2ehM/SKL6mUF7lXjFF6QsOF6Yne0F?= =?us-ascii?Q?o3JikkP5A/+YkKlvobRTdERcEhf2tqSmO78wL6P36WkSXKNJrowgXLOTehYM?= =?us-ascii?Q?C6RkIxIZt8+qnXvV77hFDn9R8SAKu8DsVpGjTcgHCwnMeNvqUtYsPnn6sxLN?= =?us-ascii?Q?6qGPFl5UAHfFDO0Faa/QUweFHrcnvqH6u7MuJHyNt6v/yhJAL9+jhrKVdLmE?= =?us-ascii?Q?mnUzkScCXn4EUFc4/7Yq0Qb25SeY+mA28KH14mVYPQozrzK1Fhj9bbJ9XEOk?= =?us-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Z3cTufWJ6uaCmtbbFVVSm+PkOQIbZiK6sr91PuEr?= =?us-ascii?Q?gMzu6U4VpVYiT4dp7hFYlAONAcEHQJonsAd9iyVAvqCh9O2siknXphzuAc1D?= =?us-ascii?Q?/DUTSTivUHo1b8QI8F5RKUe9PWu2/ViHYOnYP6gSA6ViQvEPhqMdOt3WSH1b?= =?us-ascii?Q?/fUJ5m745J0YaG7hKetv94?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 5:TH1kCAN5Y3y0Y7YtksavZ5XQie1tKuJEyKmSiSM01xxBB87YpbZYl+QE57v6HPlL4u4BOFaf9utGRMTnCiG6+dmpfLeg7KEmTFwYScN1jxk5FE9fH6prbHIU45NN7MbsKNY+uET/ERt6t2x/7YRt0HXA7Nj8eIraseTEsd1l3EuhmPZN7F1ZAztPbTqVX5nzPniTBh0Dc8/c5LfhM8PCXXdjmOOtiNrKqqMlXhHgKjfOtajjlOV8Ysbe3rUR9nyr5F9TU+4nRyl0NvGF6JmlbIOCMuKcyeoOgdSrd20FbojqxuaijuaylZ1V7xQPrmyx9/zcsryJUjx/L3ne5zyQDMsQpbWSKk5H360SKRCp/bsOi6ZLQo5hHhYRz2HframfTAy+Co1yyUTktI+nP1kg4hOLkGRdgz+oRxPnoI3smqONawrT8LWPDbn5F8isKp9K671mdHxGM5bYo41cZW2M74MONGqRrF9PENm0pD1K2TLCoLBYkNnVO0sl5f4UReJ3; 24:n9ZmT+2i7AEH0ImqyqFF9OQ+zyWFj8XX4c4veWWBv3qkOtnDpWwOqAeX5j69jupwUawz9HvgbzAjUj4KaDyJyn+dnZkQZrfttlHSoeQncV4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 7:ktnonSVtTHtMsk8hdjC1/xQlzbcXvMMMJ6QNw3yP4i/qqjXpZqd75aVkqBKzPEOFVcJGjOdUiuhkJICV/9Kk/9FysGUPoAY5BztKbzbHUGPawfKv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-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1151 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When SME is active, pagetable entries created for EFI need to have the encryption mask set as necessary. When the new pagetable pages are allocated they are mapped encrypted. So, update the efi_pgt value that will be used in cr3 to include the encryption mask so that the PGD table can be read successfully. The pagetable mapping as well as the kernel are also added to the pagetable mapping as encrypted. All other EFI mappings are mapped decrypted (tables, etc.). Reviewed-by: Matt Fleming Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/platform/efi/efi_64.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 9bf72f5..12e8388 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -327,7 +327,7 @@ void efi_sync_low_kernel_mappings(void) int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) { - unsigned long pfn, text; + unsigned long pfn, text, pf; struct page *page; unsigned npages; pgd_t *pgd; @@ -335,7 +335,12 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) if (efi_enabled(EFI_OLD_MEMMAP)) return 0; - efi_scratch.efi_pgt = (pgd_t *)__pa(efi_pgd); + /* + * Since the PGD is encrypted, set the encryption mask so that when + * this value is loaded into cr3 the PGD will be decrypted during + * the pagetable walk. + */ + efi_scratch.efi_pgt = (pgd_t *)__sme_pa(efi_pgd); pgd = efi_pgd; /* @@ -345,7 +350,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) * phys_efi_set_virtual_address_map(). */ pfn = pa_memmap >> PAGE_SHIFT; - if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, _PAGE_NX | _PAGE_RW)) { + pf = _PAGE_NX | _PAGE_RW | _PAGE_ENC; + if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, pf)) { pr_err("Error ident-mapping new memmap (0x%lx)!\n", pa_memmap); return 1; } @@ -388,7 +394,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) text = __pa(_text); pfn = text >> PAGE_SHIFT; - if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, _PAGE_RW)) { + pf = _PAGE_RW | _PAGE_ENC; + if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, pf)) { pr_err("Failed to map kernel text 1:1\n"); return 1; }