From patchwork Mon Jul 17 21:10:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9846223 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 4CA4160212 for ; Mon, 17 Jul 2017 21:19:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 837C227F7F for ; Mon, 17 Jul 2017 21:19:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 780E227F89; Mon, 17 Jul 2017 21:19:51 +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 08B6A27F7F for ; Mon, 17 Jul 2017 21:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752354AbdGQVTO (ORCPT ); Mon, 17 Jul 2017 17:19:14 -0400 Received: from mail-bn3nam01on0054.outbound.protection.outlook.com ([104.47.33.54]:47168 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751443AbdGQVMT (ORCPT ); Mon, 17 Jul 2017 17:12:19 -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=iPArdhTAK22WZkKFxK2ao7FgpAmeqxlalRcjEpTrJco=; b=Espip/wwTPUFHAkjgtgtTH1myGriQPSGR2S5fG7yTTj9TFE9NEYl+tPWPrJddlbzfWzKzX3WXoMdNLtNcKFQuO4VGhRnD1DZCbGoSrU1Pep15KDQKNt8vao+8WzSBPrnox52QrUFUsHUHtawRYL+vdX3rOVmahGArcRLf3orQho= 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:12:10 +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 21/38] x86/mm: Add support to access persistent memory in the clear Date: Mon, 17 Jul 2017 16:10:18 -0500 Message-Id: <7d829302d8fdc85f3d9505fc3eb8ec0c3a3e1cbf.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: f955e65f-f176-48a1-7f53-08d4cd587f3a 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:k66MdMgEUDWdVIfq8HUVfGfCRMiCBGBj0AZEAe65EO8KlivzwRW8DRuFBX71bu070qc1y4HIVcE+J3sqAiO1J5zveEMa508c/kr/CKn5jElMfm2d556lUjDUYkTWM7eKfrt/Dq9f2/mkGRV0Q5W45/bXc4FB9hQS6CvUe2flJqz14exQffX4qYXxst9u0GwMI4v3yZ3YfISsg2zgp90hkkmLiuaRvdfxMsAOWhxNc9UyGqtPZJoV4cuZ9Ku3BAUR8AV9BMGhkzN1uB9SpWMv7Tb8I6hOZWf52cZ/zcmibpWDa9Hb53Itkg3i31g0zN/M4NDLS/bMlQjhaBOqbXPndalLrxUqkXRKWTz1S6FdktVZYN6WWH/oxgg3+JdWczZ5JOwNE5e4kluk8h4X3Fr4Zbn3h8/x9ufWyrUgAiZfE45FA1u3/hMQ9AqCyuJCnA/3v1uRFdKSFVOIUrHz05JpKDp0xltRfvhH8Z1LzGVW3NqmKz5m+9oFNF7PPBTrvmdKWUQdz0MRQbKmTbZy14ayNtFPGMV+7GqJur4gw04DbT1Fdhpr3cMVCufzUU6W6dIVQFcdc4AOLeHy1C3LAqflJQFzDq5FBKiytNMJHN6x5x/2dJmI/7I+4pizEQgys+dAGVvqPch5ZPCdTo1kRyrrOdltqePM/6fssJ3dJcdmYA5eXFVj3SVxBsw4390VJwem7SKZ9k0j40ZAOPaDUw5qC2elOZJpfUxR1vYbieALbh6DhuTy5vti4tCb9dpeE9lBbxhwKXccXx24PeCS1/zKSQ== X-MS-TrafficTypeDi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OS/CJss2km9cC7siKYrVS3s7SonUMy/vk5VG05c/YkOn0lde3Bwbk/xI7mF9DJIhdNfi7lKaU/A4p6e3BcyNVe/wVaacliNE0 X-Exchange-Antispam-Report-Test: UriScan:(133145235818549)(236129657087228)(767451399110); 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:bS4GkuYe/G6uDD+C22pYh/RnIUc6WuFELMzZ9VXD//?= =?us-ascii?Q?Mw2jwXRRgMmXDUEXYjDKqp/blIEzte+YZ+ym9MVFi4WMAminR94C5wDHauXT?= =?us-ascii?Q?kp6QdHva8LyFQOCeArwmN2twxR9R50Xsmm3xHqcDN0QHjXI4qwMEv2dDiQjE?= =?us-ascii?Q?0KTOjI3Par0NTbLtSidhayDQ/2O0YQeD89hm4/eZEpB1KFJ/epE0cts+lWUq?= =?us-ascii?Q?UlqwoYp2NFmM0ekYVsLtd3Cds6p0zr4oc0ysRtV28eHOGwRcdAiO/brHHMy2?= =?us-ascii?Q?qTliWktVA54ua+hb5XI27WiM+5aTsHddtjMasK03UzPuZFZJDaN3uqq9WpAj?= =?us-ascii?Q?BLcTaXDS4U9Ro2yfniWkr6gtHahPJqTPIuzAk6jbN/Fnf7Goq/86wj1gburE?= =?us-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iEmFVNXU27/ZBg/Cgt?= =?us-ascii?Q?dmL2g8V6gpaUuq2TmZyfI=3D?= 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)(2950100002)(81166006)(5003940100001)(3846002)(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:XISK7vbmXHvNO9vTtMUB069WPOUw0sxckWvXn9x+D?= =?us-ascii?Q?WFEm89XSd/W70Nz2OGLITZ032zIOYzudDnsAdjAoYaxZLJHwmxg5Mx3ti4sd?= =?us-ascii?Q?vYZbSnqnsY5F76WTY50voPZe0PHbPj+dvjrUlhwxXkVZPb7436m/2TH7SUUg?= =?us-ascii?Q?FXNW95hQS4UiB3ec80ywbGzX4asflwB4q8aWVZ8V4LpjU8H8gagTdUqvdwUC?= =?us-ascii?Q?GoLvl9rjs/QV0gBm+GeRMAS12g8G7nigJb3KVUhzwIyTEN1PrGQC3xR0Mf2B?= =?us-ascii?Q?duh6Csmak5D4+Gg9mVLvBZqeAqSK5ZdwVrdzN/C+TBAFLomLvCfvFSNM4Ywo?= =?us-ascii?Q?Pw0jDFh17bCWsnOauZQvvh5tPLTFe10Bf0Nh88Y1bOXjDkf4wZMbPF6HQvyO?= =?us-ascii?Q?Ez41XtyPTeJxAl7fGbVgNmmg0wxCYu9avpx0/B5iiZDhfUxX6RzVV3352ihE?= =?us-ascii?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FLFKXs9WOWRZj0EujfWHc8fqPcaJffxF?= =?us-ascii?Q?yx/8Mud6JZOS9L6bqmEv40?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 5:QJyqWoi9VRY2hWatgGwD0tfbt4V78Sc5BGn1VLx6khwh7Kxl8FvbgKCU3y1t3nquI6JEPgglqAd8doYHBgElny/XzKZw9pyQJfJ4cgdSpD8i3fyOAI9BFKMDmpFmAzhMkSay3T6ITARseAYYnSfQ6enF7eLL7pIE3ZYJf9c2iDF/6ABDnX2+Ir62wFb7Z2gDfqRD/CxFYPOS0ZcN+9rs9Sg52zuaN1NLmSwAriRKNzT9dXHtpcFGAm+bqPlxqOHj5t+uzALnUNbgZZa4ObORcCFOWHBl0Y1o+7Be+7u5N0yMzUaUZgCfwaG5WSl2eQBnJ4Xk3Fn/G0MOXsC7xiX/8AF4d/krmny09LhcWS1BIflJClZmprr7pTLx6OgkNxerQzydvCQAGu8fzCZ2GRGAhudCZWuDEtXxs3mV93/2TZPg3iJmjSGqgSc/Yo96HmIp1PkEzfLo2MaO28irH/PyYuFVBoJLiiMMZ2zbYyPAgZTdEJP9SmJ/abCc9087s3A3; 24:vlGIuf6wh0rhZ471R4t8vgliGPhZQSdNc6sIke+vgBS8OMbRrz/5YSk377cRCccyNrqFmPtGZVn1OQt11ELMZR7YgswG899kJlrbvpFP9fo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 7:3nLLWjNgD6+oSNthmocy8C9424cCE3AHYGQIHdDvdOrMhlu1xQQo+fkilZGUXl31KYjCDsFTmY25qvEk7CcVdqv1nTCbYwc4UOydGGeTV45F5byCTQIJ6hlLBlxa/kMTQz9HSYIDiME3Rq0362mDpo5pshF64hEVRqjTBLwl58gjZokJxs78g6y4zqDJZ1dh1xqBazTRxSXqbsfreJ0p8gQUpPrgJVEbavjuHe9RgoyyEcHd2GNgyFENKFQigKuwbE9vprHU/H2fIfOwBGaJ3/yzmV/gGAqFCT6yhUJTcykrzj1H3ItMvheuV5Qadtvx0g3jsstK850zeGTSPGvdrz9jYFOmMODfAWnB7/obWUH8jHKsJOrTIQNnO9SK3kBicKKD1F7RgbHH4Bb9vexFjt/0Qn9JAwSOmXIey9wb+KO0tNwZVyJk6lya9onyMmEEj/exYSt2f+GrSfQks60HQIs9vVsteDQWSPFQy93R3FYPFWYb+oPO4vRCNSFg6JX/433K+SSgl1OU46x9YOqbkfkmSqhHfAGMwOBedIzPHRUD5M28e3dNAkqsZGvUQly/KI1WxA6plkYDfS4CL5dzOZyRZf1A/5GEUOJSgc0TgojxG9ipih/pQm8MWBhyOWkf2XJBG7DV+WL1RPm8vla88uCyZPuRF8hKx4+fXOgda1VhySq8p1qPVZoJ12002vCV7EKMtP9T/nbONr0o99OFCrm8yp3J0dlv9SVmZWsdP87SFBg7y34o3pQ2uEjZpFpxFM4cDWUw9rKCV6wZQJZnxeRQDDvvP6JFebePx7Nu84w= X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1151; 20:brAywT4GiuF/HIw8TDmFvu1KrEdq0T92+y3pO3j5IjapYN+Abs0tTNV9P31CR8uFfZPfhaw54Vqg86jmcLkRCAaQHX8Opd4U7CS6ySlu92IvVaVxcDc95t6q8C2fKvcZghxQ4TJCwcuBrfaeHWcV3flBgElOBqTMOfrusqq/2JagND60/IW76K/F0aObno7F9DW7ltJ3ri+YKmnkEZUlLQ5KkYXhCsz/8x6R+3NTZ2yePu395j4Jf4kuNtlkxGEe X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2017 21:12:10.6839 (UTC) X-MS-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 Persistent memory is expected to persist across reboots. The encryption key used by SME will change across reboots which will result in corrupted persistent memory. Persistent memory is handed out by block devices through memory remapping functions, so be sure not to map this memory as encrypted. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/mm/ioremap.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 8986b28..704fc08 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -424,17 +424,46 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) * Examine the physical address to determine if it is an area of memory * that should be mapped decrypted. If the memory is not part of the * kernel usable area it was accessed and created decrypted, so these - * areas should be mapped decrypted. + * areas should be mapped decrypted. And since the encryption key can + * change across reboots, persistent memory should also be mapped + * decrypted. */ static bool memremap_should_map_decrypted(resource_size_t phys_addr, unsigned long size) { + int is_pmem; + + /* + * Check if the address is part of a persistent memory region. + * This check covers areas added by E820, EFI and ACPI. + */ + is_pmem = region_intersects(phys_addr, size, IORESOURCE_MEM, + IORES_DESC_PERSISTENT_MEMORY); + if (is_pmem != REGION_DISJOINT) + return true; + + /* + * Check if the non-volatile attribute is set for an EFI + * reserved area. + */ + if (efi_enabled(EFI_BOOT)) { + switch (efi_mem_type(phys_addr)) { + case EFI_RESERVED_TYPE: + if (efi_mem_attributes(phys_addr) & EFI_MEMORY_NV) + return true; + break; + default: + break; + } + } + /* Check if the address is outside kernel usable area */ switch (e820__get_entry_type(phys_addr, phys_addr + size - 1)) { case E820_TYPE_RESERVED: case E820_TYPE_ACPI: case E820_TYPE_NVS: case E820_TYPE_UNUSABLE: + case E820_TYPE_PRAM: return true; default: break;