From patchwork Mon Aug 22 22:38:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9294603 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 10F04608A7 for ; Mon, 22 Aug 2016 23:14:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0275828AF7 for ; Mon, 22 Aug 2016 23:14:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E841D28AD7; Mon, 22 Aug 2016 23:14:23 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 756F828AD7 for ; Mon, 22 Aug 2016 23:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756656AbcHVXOD (ORCPT ); Mon, 22 Aug 2016 19:14:03 -0400 Received: from mail-dm3nam03on0089.outbound.protection.outlook.com ([104.47.41.89]:61046 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756487AbcHVXN4 (ORCPT ); Mon, 22 Aug 2016 19:13:56 -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=jUYzx4sfqgwr6d5Vr3Z53e77214vSZJtoQ8BBG5Hajk=; b=RjbXR6jCOHETn8rs5e+ozlxBrXqWs8fdfVCVjvYYRM5FQVCEF8zXgJbu6dFn1l3DAIw5Ti3TAlRtxTRfTemlpO6bNwx82vged7/4L9LcB7ruDg0DVHS5gzUXkFUgDI2TogzyOJ406hCozzqLwHdwqvAHBM4rIOPDPiAtX8xQbLc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from tlendack-t1.amdoffice.net (165.204.77.1) by BN6PR12MB1138.namprd12.prod.outlook.com (10.168.226.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Mon, 22 Aug 2016 22:39:01 +0000 From: Tom Lendacky Subject: [RFC PATCH v2 19/20] x86: Access the setup data through debugfs un-encrypted To: , , , , , , , , CC: Radim =?utf-8?b?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Joerg Roedel , "Konrad Rzeszutek Wilk" , Andrey Ryabinin , Ingo Molnar , Borislav Petkov , "Andy Lutomirski" , "H. Peter Anvin" , "Paolo Bonzini" , Alexander Potapenko , Thomas Gleixner , Dmitry Vyukov Date: Mon, 22 Aug 2016 17:38:59 -0500 Message-ID: <20160822223859.29880.60652.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20160822223529.29880.50884.stgit@tlendack-t1.amdoffice.net> References: <20160822223529.29880.50884.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0009.namprd17.prod.outlook.com (10.173.147.19) To BN6PR12MB1138.namprd12.prod.outlook.com (10.168.226.140) X-MS-Office365-Filtering-Correlation-Id: bdbe02b3-e727-4a75-a12d-08d3cadd1da4 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 2:aJbwfCHtjZ+g0xPaksefLDTEVs3Mrk6F1HP4FBqX+0XW6DYC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5L383stuAJ5winIxv2VZcpZ4I+TJtDLo6arjKC4oXjGqgWTopfP9gBEpyKCK7xU0M/hM/uUU+BxZYQZG99lrT48vZvvZ/Xz/7RWuvshmdZw5QhwRD02LcH86ktz03qPcg4yPUwM/i4O6iUdNEgIqIzeBhWRXH1617f6yEdk3XJzEtdPojR6oT0BDj16uRd6e1UOW+CJ3qsLuF1Odh0tItEzhIHKFI7n8K6JsuJ9L7Yk/ZUO8Za5vYC/fpIIAjNBiDhcj4UyBgO8RPj3QKrrsS+xe/IYsjNvzbTpS5wvgbpsT/scUC8as5VldydA3jM7vXKjCl0YJYxaxjlQ5+rd+XJ2hP1pnmCdCBMbnRZud1qowHSXb1cM0yrnMwjCkt0WVrEuaXi2wVoJ+PfOi3W+yYW6zJOGGgjA5XrJQrxExQhb11ChnhERO+FbXinztDtsxKwjXsVcrFmdt46+1wJ0EZA1DTppZymmrcp29H X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BN6PR12MB1138; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1138; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 4:KCiHpIqtx1YSn9PRndA6KKhCalFMl1da4sqL+W5FT6Hdc4IMyePJ1mccrU7ELAsuY9LtvDuwqbzzmv8EcIDYgU8Ujde+zF0XdiYG5MKbbunHKd38TfDERsoB+1JCRaIXTOXuAv5eJ35LybGtxkOZtA9mZi0+pfYx4Ad2Co7BIKZA29MgNp1sRF46YLxt9Orkru9+fx8owpclLdpNnEjzFzFgDqA33OPwiDC4B8UVgTqN93+tQ1B1uPcd2HgT1p4GukSCPUifBXDtc47xUL0J4Ofeso/jd5/TPPXkCe+GlJ/l1iE/1ijKJXIhjTlBkJ1ZrEHb9Je+ylUsT189NhOzHQx+xQ4TfpQsH5WlBsRfckGFZJFxfHYY8XShV/oBslzau+O/pFyWSJdaXCdgEYEsiLGCYUQzwUzEKE5x19w/SnjOgMXRFVrkEw2zqdcq+7+R X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(47776003)(9686002)(68736007)(7846002)(86362001)(19580395003)(7736002)(66066001)(230700001)(6116002)(42186005)(189998001)(103116003)(4326007)(69596002)(2906002)(19580405001)(1076002)(50466002)(305945005)(33646002)(83506001)(5660300001)(229853001)(105586002)(7416002)(54356999)(76176999)(50986999)(97746001)(2201001)(92566002)(8676002)(23676002)(77096005)(81156014)(586003)(3846002)(5001770100001)(4001350100001)(101416001)(53416004)(106356001)(2950100001)(81166006)(97736004)(71626007)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1138; H:tlendack-t1.amdoffice.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM4OzIzOnVXOFhXVVI4NHpwZ05pUmtiYVdMbWVwOS9r?= =?utf-8?B?dzNncHduY2tTSld4NEk4d3Nqa1VOVXZCWU84eXpwbVlFRlBsWXZLWU9IZS9J?= =?utf-8?B?T0RDbEJoTk9LTzFLblBDenV2eFJsb0NPektkeEZHcThXKzU1SWIybXBmd3NN?= =?utf-8?B?Ukk5VmQxUGJKYnhNZkU5YU9OVnZkbWRRV2YrY1pUVTBsdGppaUxTMnhQOWVZ?= =?utf-8?B?RHBzNWtUcXA3NExXMlNUdGRlNDZ4UnRlRnFoZnppMEFEMEVkc00rR2t3Zmw2?= =?utf-8?B?MThuZUpDdHlWNll5bGhNY1lyNHYzdXpCQkNGNVFDdTlLMnNlRzJjMi9MdzV2?= =?utf-8?B?ckVVUjAwcUdrcWdIVHozSkFYTm10eitWbWJmVDV4a3dwNUxm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gAn2IedvyUJJUDHc1C0ZEy3Il95Y3ppTQ==; 24:zi2HXtgUJMwU+SziCVBQBVoWDYQw9fNTJnz0YsCsKyrgdX76Hg5njLIh/5kXyAs1yvX7q55Ey550pvYS4iZG1gYHobznfimreBGes9GTdfY=; 7:iTw31v2x8XN25PES9HtvZ7BsjEuDTpyWJJGWc/keYPAD9BYthmq/7MiizPyoPjt2m2WyRi9qKb/etGTU5QUlseZpYF7iT6Bdo5XJs/y/pinZipHWGKpA9G2gotE/QBn5l02U2yUWk0xdmSD0Y80etNa2AS8DHHemDHsuLH4OCTBSMjgUC0eQcXgU1eLstaoam904Let7k5OsNpOIgm4oXdo+x4K2FqpByQTxECnNoMSTq3OuqL9bJ+mhbgLkqshP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1138; 20:4rBMfDHncIR1mYVuPeS2t5sjPe7ci3yfPxiOH+I7X5EnHiUl19w5eiOOq9zycGkCiyPqtO3Wj/6NzsBK1wMYNu8XP4thvHJKMw8erbUXNNrzJkeXuTPxiDoPZJEbfSC8TZ7pBCgLY/2+BIFLQInOZoAgpouoYKVIWkNx9ZvaUEJdyJpJysNaX+3ocf5OJcouBP1rb8V9BZa1uMgaN5u1hvF/c/Ah+WiHwJZ41q8Qcruz8d4QvKPAejbJWUdv1Qge X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 22:39:01.1433 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1138 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since the setup data is in memory in the clear, it must be accessed as un-encrypted. Always use ioremap (similar to sysfs setup data support) to map the data. Signed-off-by: Tom Lendacky --- arch/x86/kernel/kdebugfs.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c index bdb83e4..a58a82e 100644 --- a/arch/x86/kernel/kdebugfs.c +++ b/arch/x86/kernel/kdebugfs.c @@ -48,17 +48,13 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf, pa = node->paddr + sizeof(struct setup_data) + pos; pg = pfn_to_page((pa + count - 1) >> PAGE_SHIFT); - if (PageHighMem(pg)) { - p = ioremap_cache(pa, count); - if (!p) - return -ENXIO; - } else - p = __va(pa); + p = ioremap_cache(pa, count); + if (!p) + return -ENXIO; remain = copy_to_user(user_buf, p, count); - if (PageHighMem(pg)) - iounmap(p); + iounmap(p); if (remain) return -EFAULT; @@ -127,15 +123,12 @@ static int __init create_setup_data_nodes(struct dentry *parent) } pg = pfn_to_page((pa_data+sizeof(*data)-1) >> PAGE_SHIFT); - if (PageHighMem(pg)) { - data = ioremap_cache(pa_data, sizeof(*data)); - if (!data) { - kfree(node); - error = -ENXIO; - goto err_dir; - } - } else - data = __va(pa_data); + data = ioremap_cache(pa_data, sizeof(*data)); + if (!data) { + kfree(node); + error = -ENXIO; + goto err_dir; + } node->paddr = pa_data; node->type = data->type; @@ -143,8 +136,7 @@ static int __init create_setup_data_nodes(struct dentry *parent) error = create_setup_data_node(d, no, node); pa_data = data->next; - if (PageHighMem(pg)) - iounmap(data); + iounmap(data); if (error) goto err_dir; no++;