Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168AbdFLNc0 (ORCPT ); Mon, 12 Jun 2017 09:32:26 -0400 Received: from mail-cys01nam02on0040.outbound.protection.outlook.com ([104.47.37.40]:48160 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751990AbdFLNcT (ORCPT ); Mon, 12 Jun 2017 09:32:19 -0400 Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=amd.com; Subject: Re: [PATCH v6 14/34] x86/mm: Insure that boot memory areas are mapped properly To: Borislav Petkov Cc: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Rik van Riel , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Toshimitsu Kani , Arnd Bergmann , Jonathan Corbet , Matt Fleming , "Michael S. Tsirkin" , Joerg Roedel , Konrad Rzeszutek Wilk , Paolo Bonzini , Larry Woodman , Brijesh Singh , Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Dave Young , Thomas Gleixner , Dmitry Vyukov References: <20170607191309.28645.15241.stgit@tlendack-t1.amdoffice.net> <20170607191539.28645.70161.stgit@tlendack-t1.amdoffice.net> <20170610160119.bnx5ir5dj3i27igx@pd.tnic> From: Tom Lendacky Message-ID: <64d7cb4e-64fe-0882-ad17-fc3918c3a09a@amd.com> Date: Mon, 12 Jun 2017 08:31:58 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170610160119.bnx5ir5dj3i27igx@pd.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR17CA0023.namprd17.prod.outlook.com (10.173.147.33) To CY4PR12MB1144.namprd12.prod.outlook.com (10.168.164.136) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR12MB1144: X-MS-Office365-Filtering-Correlation-Id: fb1f064d-7092-4194-18fb-08d4b1976af6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:CY4PR12MB1144; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;3:XAVJKWV7hWtHmIarTqleHsX3cQead2/j57wNrfcJNcVgForgMxK9+WE9dfDe5B8IGtfeCGZVzWDFB6WNk04CWKOJ3hz6MA5Zgl99p47UFTMf7y6iF5fefmoRpjM9/VNg1YkaMarX9cwoq9a9Jh58QoDq8UVk8SmTtQ0eH7O5mftnRL775Cyt59JlbrapHiRnOvVwkZW/GVcAa0zV4IDNC/A+SzGoon5yVOxv3dn5xavr9YvzFczLATPh8UOZgVmnjP0N98EVPumPSSsS6EUO1fvv7sGBLc7RasMrPtdTsiZ4qoXDvHbd4wR0Yjf+XObMm7m56Zt5TYCbJyWzxG7FDuU3YgAWC3nF1VffSnH+aJ8=;25:aNKlTXAYv/6bje/lPdt7LJeaP6Sw8m6hh82AZs/a/E8L2nT/98ZOkmLoShDkUBuf9rpoZaqoLzz8dLtRQqCejjQtTXn+/rUj0jRKJoYYOSpXaFzArPB6+aimhXpWenIsrx5a483LrhwJ0d6VFwMF0ySzRyi+h3VqCfsbpygEV/mP0z2As17k1mPJEYNhH4uVBvKzz+FyBXU+MU34vpQKUzDG/ij74e9Jdtz+KX3eCMSI8i0tGiT3+cEeqTGBn2mdXaQNNAOeHn80G4zrTZd/QNpyAb6hnhQamCONmxgguaSjfozxM43QSEiR9MlFyDJ8vDGCuDgkBzaX2rAyCHLqMk24hiPnr5wzOnqpQXCur87HLzXnstnzCEceXwXi9ckL8gmqcjPfr285ZtSjHJxZgUIRyXStlbuYO1YF3+rC1jS/x3BahSDlG/6lEYWRDDcxsmG56yFFLMBaKyW2h4EBTciiXVKiRCaSduBX990kF7Q= X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;31:qXLT9VYL36RVIQvYRF30Lz+hcokXQpY+LRCrIa58sowo+CRS26rzFKL5edzi73ZJ3Cnj25lTMuxSDdNaDZmV0zYH/URwPOZbeu1lvG5yC+JoP3rkj+wgK54sGU0wWbbdwjDhRteKTV0xIy2Y8u0OqpJTNT2VfJYnLwYdtJZsTcVTtGHaUNP2cAjY8PGnXVr6SFdl20KEMB64gqxkliTHc8OSwfJEVMKQem/ZjwoCpSg=;20:9ReSxusb9gaq5EcVqPokn29Y58ZNJ/4xLgX/43ZfPr0qU5eAe8i53yM8NytJxqZI6tMndyQ6sNRZt646NSK56O1QubFydddMtsQrgmvRTTuBKxW5Vq53U2Uvjqu3JRE0834pTVT6ah+Z7xKv1zKW84Xtr3gZDQ9BaNkAZj8u5/1hYD73Ot+EIFNtX1f9an/3mGZza9e6CSm6vvbPfVG5beg/vHQSnIaKqjmHmBbQlGmmrmzA87ONb7ux4mlxjWDkg9lIBbJfYEdmUliAfNb7/UXOx7bsqpxvfUVN7vieVMMiys8qqIgYr6lw2ift80HXZ3Y2h5i03zrS0DLiiQzOun4LlRzyJ6DH0vTACncA+yush5IKKrG/7BBRXY8n7NnEqgE8WCj0CfTcySDtI5WraWKgpPj53D34WCy3xiy+F6x59JS64U5iWNjT00ssBAfO1fsooSKkbsHgIYd8j3jA/yEAmRNHer6bIs73cA8qEvUvWcJmwy0SoZpQh63mV+JQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR12MB1144;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR12MB1144; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQ0OzQ6Q2NOMUN1eTRXbWplYmRjWVo4NXZsNWh5OHVu?= =?utf-8?B?RXY1akdLRVpWNFNRMGdBMm5rVnY2cTlvV1daVXhxOXBpam1HRk50ekxObUdU?= =?utf-8?B?OXRUNWNTOURBUldoZDM5bHBqN1AvZGltUHpjbE0xY3dPTWttdFpEb1BSVEli?= =?utf-8?B?VG13d3FYRk5hNGZYRkFsTGxLdy8zSU5VMXdxY1dndWZ3aUk3NFNldmYzbzZS?= =?utf-8?B?cEc2UjhjM2dHQTFrTTJBbzVyVVRuc1ZreUk3RlNTUTlUVWJEVm1qbmpYZ1N5?= =?utf-8?B?V0wvY1hFM1lPNkdhb1o0Mk5tZGFSaTlPTlRTNmNiOTg0cnA4TWd4aHNWZnRH?= =?utf-8?B?Ty9YcmQxbDMwa2hpdEpLb28zT0krYkVRbXZIajBWY2crZlNITUJBSEVwcWxz?= =?utf-8?B?eVJTNUova1Q4V1d5bDk1SkdxQWt3cHNNSEtBV2VlNTdaL3pZWEV5dFI5RzI3?= =?utf-8?B?T2lkMjN4TnRYU0F3OTIvOXJnalFLMW9kRDRhcGNDQWY0RlMzSU1ST3EzS0gy?= =?utf-8?B?aHhkbk5tLzBYSnpOR1UxRElKNnkwVlhSQU5HMktzRGV4VC9nM3lObGNEOGly?= =?utf-8?B?VGpraUNxUlRMV3kveWdEL05TMTJPM25pZ3hTOU9QLy9NTElib3V6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EdmxCTGZGQzdI?= =?utf-8?B?NG9xZGlENTdkQU5EVFJ6VDBHYjF4d0VMZXBWYzFQNDBqMEl1Y3dXYk8rUWJx?= =?utf-8?Q?SDy5Qv6ynNGOiozbweI?= X-Forefront-PRVS: 03361FCC43 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(39450400003)(39860400002)(39410400002)(39850400002)(39840400002)(39400400002)(377454003)(24454002)(7736002)(7416002)(3846002)(7406005)(305945005)(189998001)(5660300001)(65826007)(23676002)(42186005)(31686004)(76176999)(47776003)(54356999)(54906002)(36756003)(81166006)(50986999)(64126003)(33646002)(8676002)(65806001)(65956001)(66066001)(31696002)(575784001)(86362001)(6246003)(53936002)(38730400002)(6916009)(6666003)(2950100002)(110136004)(229853002)(25786009)(53546009)(2906002)(3260700006)(77096006)(478600001)(4326008)(6486002)(72206003)(90366009)(230700001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1144;H:[10.236.64.250];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQ0OzIzOm0zekRpTk94b2RSMjNOYmtuSTdwdnFGcytv?= =?utf-8?B?bkMrRklTSmUxdHp0MC9WKzE1VkFSbXJTZ0Vud1IvTk9HNys0SWpNeVN2WDhK?= =?utf-8?B?L2RKUXQvalpZZTRnK2NvUlFUMVhUakVwSkk5ZEEzS3pwUzRZRjJ3MWpDQy9h?= =?utf-8?B?ZlYzUlg5anBHdXBiUmowandMREJPSS9ReHZRVU4vKzRRVFFXRTI2d2NTMFNq?= =?utf-8?B?WXpCeG9EQnhXV1Y3MzBQNXdmVDlIYXN3VGdjOEpidXV6NmU5OEwzc2t2YUtm?= =?utf-8?B?dFdyTG5GaXY4TCtNdXFGQlNpaGQ5RVd3bEErdEpLL1h0MnN1Yk1SZ09FdmN3?= =?utf-8?B?ZkhGQkUxOTFkUDUxcmFkcVkrU0RWN2pMNXB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HZLBLMRG/z/h+IuVIIE6KRb/w1KJd/dp7UnnjCB0mqhJF39CTNlyTBF1f1OOiV9AyiH6+SjXNgHfOMu4qebFWTyJrJggjppzRstafYF2B1kAYl7EeOBJKumCtyJ5XzIRONqFQ01XrfBjsd9S2HlQWvRLwrSSsHBh7MHAZ4kUBo/I2/qS14fXNw4Pv02JuQ+PaWWNgZX/i+ly7iO+9xaM2KL3zAOI4LydnvPprNdPaWaCRCtJWZq2898Y= X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;5:83Rr9oc3qyScY4pRGgT7iZgi+NCqejNG/GRqJp8I22qJTVeHLbj0TXX7hRA+aLUfhv6ATGiwskGSFx7AW63LC6hY7Fgtanie8blWpd5fs1dwehcdRD5CFOC4F7kB2r+8dfZWGpxH8+CSzNPClajcyuyKM0X8nW44kUzHG+z5lJmqML/3Ks+xO3fwsSe0F8C+gATvBLZ42n5SV+j7isRaZQc74EPr5lFA8Se9irdEUOI3Y7cr11lVrmOaPyG2k3ZostdAwoPx8mXYdCsOzQI0fqDjYbiAAYeG/OwS/KaFLY72TfZiMUoI6JFPYoDT+ZrA30mXOzmgupP7XxtVB+etg6vGegE5Z0gPm6FX6mYnVTpfALP/O21tsz437G2mLJDaHqlZo3GC5pYp/yRDYjK5yirIiZ4bDrfrMGShaClostjclKniBLRQZDR+4Fpc6VXCuHRrcJIG2SmEhIMuzsdFowXZcSGZzoR2HfjpxegKWTZ+5far80yXNHd4K9iwjR6h;24:p3cd/4jwQ8rbJqnzCY9kmHR8PsmWBa0LTLhz3ZjuG0RVffdKcgV06WFTwfCj3OdC3i0nlUdd5GLEzC6E/TNXq54vOakpH0MBJeV441WheYc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1144;7:oai54i2KUnFiNQ9ORRhJFaJbTRt+smnuSppG2Z7vVnB+ZwEjT4pURKAeZswreOMxtIxBvvwrvXORJWeZ1Sl4nGJrfmVkrXQa28x1ZY3PyYhJUG6YIPp6O3c53aZakaI0onMOwLyCAmxGn8VvWLj9wcawycUEoRzHV+ZcRe39HysIN60E4UH5aOg3yklxpbQP4tUO5B+/hL92Pdz2jRnydz+YLPcvusCYhkKL7xfsspfTE7Dmlsc6ZxsiDL05SMn/yjYo+snxVbFnyX/PmJOvNBf8v/jzIMgW2em7wXOA+hxl4+iWEyOsBiRBykQwRmWmokJDDnIYBYpfpfl4ER7ETA==;20:hioy6s5QDudTsTbv7xbpdOE/TpHr15Q2f6Vs5AwJOIDQZjMD1RLk3m9Y/WhnlqSdJaMeox67mY9wii9/7Pf9+DmXdkL1pN/LkgOuJ2RX9V3zNFsaA+u5DAQysZM/E+4i623E94msRLU5WH7Ty9EOPS/6W/UQTkyhhFdxKytNxQXMhCp1Zt0ljNYLEliJQhOvN2V5mrVGDkXfuPnrbEw5t7cnIi6u9gAdMQQ0Bi4F427mDkW2vdYIykrtikRcb4Sg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2017 13:32:02.5804 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1144 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3978 Lines: 118 On 6/10/2017 11:01 AM, Borislav Petkov wrote: > On Wed, Jun 07, 2017 at 02:15:39PM -0500, Tom Lendacky wrote: >> The boot data and command line data are present in memory in a decrypted >> state and are copied early in the boot process. The early page fault >> support will map these areas as encrypted, so before attempting to copy >> them, add decrypted mappings so the data is accessed properly when copied. >> >> For the initrd, encrypt this data in place. Since the future mapping of the >> initrd area will be mapped as encrypted the data will be accessed properly. >> >> Signed-off-by: Tom Lendacky >> --- >> arch/x86/include/asm/mem_encrypt.h | 11 +++++ >> arch/x86/include/asm/pgtable.h | 3 + >> arch/x86/kernel/head64.c | 30 ++++++++++++-- >> arch/x86/kernel/setup.c | 9 ++++ >> arch/x86/mm/mem_encrypt.c | 77 ++++++++++++++++++++++++++++++++++++ >> 5 files changed, 126 insertions(+), 4 deletions(-) > > Some cleanups ontop in case you get to send v7: There will be a v7. > > diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h > index 61a704945294..5959a42dd4d5 100644 > --- a/arch/x86/include/asm/mem_encrypt.h > +++ b/arch/x86/include/asm/mem_encrypt.h > @@ -45,13 +45,8 @@ static inline void __init sme_early_decrypt(resource_size_t paddr, > { > } > > -static inline void __init sme_map_bootdata(char *real_mode_data) > -{ > -} > - > -static inline void __init sme_unmap_bootdata(char *real_mode_data) > -{ > -} > +static inline void __init sme_map_bootdata(char *real_mode_data) { } > +static inline void __init sme_unmap_bootdata(char *real_mode_data) { } > > static inline void __init sme_early_init(void) > { > diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c > index 2321f05045e5..32ebbe0ab04d 100644 > --- a/arch/x86/mm/mem_encrypt.c > +++ b/arch/x86/mm/mem_encrypt.c > @@ -132,6 +132,10 @@ static void __init __sme_map_unmap_bootdata(char *real_mode_data, bool map) > struct boot_params *boot_data; > unsigned long cmdline_paddr; > > + /* If SME is not active, the bootdata is in the correct state */ > + if (!sme_active()) > + return; > + > __sme_early_map_unmap_mem(real_mode_data, sizeof(boot_params), map); > boot_data = (struct boot_params *)real_mode_data; > > @@ -142,40 +146,22 @@ static void __init __sme_map_unmap_bootdata(char *real_mode_data, bool map) > cmdline_paddr = boot_data->hdr.cmd_line_ptr | > ((u64)boot_data->ext_cmd_line_ptr << 32); > > - if (cmdline_paddr) > - __sme_early_map_unmap_mem(__va(cmdline_paddr), > - COMMAND_LINE_SIZE, map); > + if (!cmdline_paddr) > + return; > + > + __sme_early_map_unmap_mem(__va(cmdline_paddr), COMMAND_LINE_SIZE, map); > + > + sme_early_pgtable_flush(); Yup, overall it definitely simplifies things. I have to call sme_early_pgtable_flush() even if cmdline_paddr is NULL, so I'll either keep the if and have one flush at the end or I can move the flush into __sme_early_map_unmap_mem(). I'm leaning towards the latter. Thanks, Tom > } > > void __init sme_unmap_bootdata(char *real_mode_data) > { > - /* If SME is not active, the bootdata is in the correct state */ > - if (!sme_active()) > - return; > - > - /* > - * The bootdata and command line aren't needed anymore so clear > - * any mapping of them. > - */ > __sme_map_unmap_bootdata(real_mode_data, false); > - > - sme_early_pgtable_flush(); > } > > void __init sme_map_bootdata(char *real_mode_data) > { > - /* If SME is not active, the bootdata is in the correct state */ > - if (!sme_active()) > - return; > - > - /* > - * The bootdata and command line will not be encrypted, so they > - * need to be mapped as decrypted memory so they can be copied > - * properly. > - */ > __sme_map_unmap_bootdata(real_mode_data, true); > - > - sme_early_pgtable_flush(); > } > > void __init sme_early_init(void) >