Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp12665imm; Thu, 30 Aug 2018 07:13:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbnMLv6L77RnkuwOqtQdefITXNNT3TtIkSK+LqixabpniqUJzON0YrlV2HKCT6QBJ4iwNwL X-Received: by 2002:a17:902:d917:: with SMTP id c23-v6mr10411832plz.65.1535638407817; Thu, 30 Aug 2018 07:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535638407; cv=none; d=google.com; s=arc-20160816; b=VavQUD7FW7qtndPSJSxk4SHiyx+/YnL4Cl9iZOawJcwFp9rSjnLC6eKWM21qcAzP9a Scy6NbZOZ0z1N75h3PbV51EE1Iv7wFD9dxhrcZ5N7HTX9cRmOoIGnrMVqz+8OutYj7bH 8qGPhGlJGw20Me0Q3c8SbgRP1hSWbhml+T7E77SududiQnBajrd50fqTGoTkUw/nQS/+ 7qOdHwgseq7PqHgB5eREAd4jnMRfaG78FZdhkOLt9ipepEiE98D6OmvBMwGgDD7s1zQc P4auQw30bygForEpcw7OOlcWjoNWZpcuQfsqmbk3gQw5OorXY0C3ET3PIiDqszgo8zwE NDXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc:dkim-signature:arc-authentication-results; bh=3LhqdyQCrvEej5C83dn8hPYQ1BjzM83REywRl2Cz9BE=; b=IO2gXlHkNHT5PlJlCJuJN7uSFW/M7ipjMDwkDb1WWjv9jYqpk2wZPVnPY+V3jWoaRq mtgy+hy6V7uf45+V2C+PRInihGWBxzqCYm+wuOO9v0qo5VUKcU/GzNaIcuDpFuwUhm8d lTLrL+2iFrQc9DvS3gqixcVOFzClZKo4Vzi3YZzylSoRU/iaEJMreTGHNtv8UwCXNimV f7UmPgrR5H2jSd4Nvt1sW/Eu0LJMs9pP1gnfJfEsYWyQqvEOFgGsSno56DwrSaWNaBV4 VWKq92b30nVmAx4eNMnyEhq1mwf+CyrHBnXaUNq9KxQZePTpDui5NyCCpsDo6aqvcIwI qEPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=VA8di6KW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64-v6si6740136pgc.516.2018.08.30.07.13.00; Thu, 30 Aug 2018 07:13:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=VA8di6KW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729161AbeH3SMx (ORCPT + 99 others); Thu, 30 Aug 2018 14:12:53 -0400 Received: from mail-bl2nam02on0050.outbound.protection.outlook.com ([104.47.38.50]:52746 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728949AbeH3SMx (ORCPT ); Thu, 30 Aug 2018 14:12:53 -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:X-MS-Exchange-SenderADCheck; bh=3LhqdyQCrvEej5C83dn8hPYQ1BjzM83REywRl2Cz9BE=; b=VA8di6KWt6uYXeD5c7UYiBryLzZ7XCTlIKuxk+aLhYyxXyxls35qUZ12LhdlYeyx8l7Nl9iFZkcxpjjnMSgUJXAvo1OFjd7Sha9UpLafz8WJCVxVNuXiqi/AU6CZWiFJbNwyUpVYogRx/s6dlBwwcZgHGrwJuPAshsf8alXR7GY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [10.236.136.62] (165.204.77.1) by SN6PR12MB2686.namprd12.prod.outlook.com (2603:10b6:805:6f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Thu, 30 Aug 2018 14:10:27 +0000 Cc: brijesh.singh@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Tom Lendacky , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Subject: Re: [PATCH v3 4/4] x86/kvm: use __decrypted attribute in shared variables To: Sean Christopherson References: <1535567040-1370-1-git-send-email-brijesh.singh@amd.com> <1535567040-1370-5-git-send-email-brijesh.singh@amd.com> <20180829195558.GA6801@linux.intel.com> From: Brijesh Singh Message-ID: <8157d535-3b6a-4e8b-5234-ee13f5ffd716@amd.com> Date: Thu, 30 Aug 2018 09:10:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180829195558.GA6801@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN6PR1501CA0026.namprd15.prod.outlook.com (2603:10b6:805::39) To SN6PR12MB2686.namprd12.prod.outlook.com (2603:10b6:805:6f::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b7d2add-154c-4e6e-b301-08d60e825659 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:SN6PR12MB2686; X-Microsoft-Exchange-Diagnostics: 1;SN6PR12MB2686;3:r74Cn/vEnhDE7+PkgWmLIhi5A83SSskhqvRr9xQcFfwohQWnWnEVPJi9U8TwYYIB7VBwchvPSJUEb372UQPGp9hJ6DLB/YZoAcapnWxOmuUM/mx8vGfFvGsni1kTbqK9IQ7BqAMVaWXmoKl25j7cVuGR7n+uZ+qH9AcESS3oVBEPnLY3KtxS39kO2vMV21LN4CXtkUt+trUpBkE2aSTwuKLIFqf8gEwhheERtrBhXB04Je+6n1ddKzfZArpmaa/p;25:LQp78g835gtBvbgtVxE+bg7HwmCrVgJtSZ9k2DLhAINS/eZkWUj+D85Y0+1hB+as5d1T/7oeWULQjt3ze7Qaw2FLFT1Iz0W40aNsuI+Am3AWMQ+d1kJtGt+080Odvd65YSIjONbWQcJjwOFRv8FORa1SXkYWmZ5bH+mxIxUcjIzSTe5IkvkfnQjmFidjcUIdzD385FmOyFXrT9FhW63TEjdmj7nryirdi6J17hayMjN/GkzXn4vaac4RLa1JgOkeQEtfwYNNrDdCsIFXddvHDyQ96Br9dzkDn6KKd23RVwnw3UGAme8MpYmv4b1GF11nf1gLOJpTzXGPwZ9yxEP/zg==;31:0hJ8cGNpPBUf9p4F1bNXv0OTXlcJ77Kh3wl9sB1oL3WKQLWF5HzelC6fxM9S88JDYBrfFLoYRBsq965D04PFkVpfMrQJKsnyBZ+vgiOoPlmoowJlSTeO1SRsGIo3HfbTWMBm+zgw9/NyGdNKQjbewLitm5NZmHLx6ZXVE0yn9TIW7I50UgLMr3D084leL2U+hLZjF5t9GidBDI98AKSKKxMFt7q3UfcVxSpbT9DiJEk= X-MS-TrafficTypeDiagnostic: SN6PR12MB2686: X-Microsoft-Exchange-Diagnostics: 1;SN6PR12MB2686;20:aD7ReGfI0EmtY/6WnhxtoXbJoRWylKRTBgtCMNWGgVvvPVXaKMrwCZUECgVAyGyLQ6G0RlBG5DGzkg+LgNp9E7BK9tER/pz1boznl0bCSGCAx+Z0+qFXq4yuWXoZEwgWqwB637lGQn1KOlmd8M67fdBGq0xtZp8ssrM44rGyMC0E+Ivn2sdB2fjQs9PqfAnwF2B+O3qW5cHBxwHsjld6rcR7+qIVrXdUyxbp2n49jPuFBftqifLIxXnorvvP5g/F++PovjIAOl2AkQipYbXqRJ/Qm8sx6h3RFMjFPgjar+MU6ryvbnxj5n/56G6tdnc1ShYJluycOgMTbL3mre5NXQ+Nu7Pgil0uGp3TrHO8tTH83IB/T3L7rlOXMbmfkZzzH2Xt6VjNd5cJAH5X3CySlrPLsagXsT2OzymkGqXP6m1W6HY/5XxOIAUQHXsjMdy9YF4KrZUw/w5wyiPM7K4NOAr3koQN2jDQI8S4vR8OhdZ+cBLrRj0syvCcvXC8EiS7;4:+kyIuoJtTica6q9hmJNbaVVbgGSmJNo2f4FaCYyD6afXY9bNPLiv5d5F3DGOR9vw/3FMv2GSTZ79m4EZJBaSGYd0ISjQJEU/HpJzLJY3Kh0GWT3uW6yDpPpOuDMq017bOj9Tk5WH8eyG9scIitm57iSvtGhrRDEs0eTIbL+m7Wel9jpnrcqqE+ZapySgtQSU26mL7cu0dTEC/lRGbMSrGyFHGhqGn3sxAxHDIrMmnzfPV9YYZ+EFpIgt1syDOzRvMMSuIMgyKnmYmSGl/edJly8huXVOdMcKT/fA2ujwc6WTHps+IAxJA8bYgLq62HEez7VtMT1r2BPAf98T1EMOcuinBALRSfZ+DKz4akqaKb8sVdelZI+E1lA9IRqIkUmK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201708071742011)(7699016);SRVR:SN6PR12MB2686;BCL:0;PCL:0;RULEID:;SRVR:SN6PR12MB2686; X-Forefront-PRVS: 07807C55DC X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(39860400002)(136003)(396003)(346002)(366004)(376002)(199004)(189003)(6246003)(305945005)(16526019)(81156014)(186003)(77096007)(7736002)(6486002)(478600001)(68736007)(956004)(105586002)(31686004)(11346002)(106356001)(81166006)(44832011)(486006)(64126003)(2616005)(476003)(53936002)(8676002)(53546011)(8936002)(65806001)(6116002)(50466002)(47776003)(66066001)(76176011)(386003)(65956001)(446003)(31696002)(229853002)(3846002)(2870700001)(316002)(4326008)(6916009)(14444005)(86362001)(54906003)(52146003)(2906002)(65826007)(23676004)(52116002)(58126008)(16576012)(97736004)(6666003)(67846002)(5660300001)(2486003)(25786009)(36756003)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2686;H:[10.236.136.62];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjZQUjEyTUIyNjg2OzIzOjRpM0J3Nnc0UHc0K1pEK3kyeDcxVFJLVk5l?= =?utf-8?B?YmhMWjl4bTF1SlBySFVtVHdFOUdFREtNQWxJemx2dmtVU2M1TG14M0h0aC8x?= =?utf-8?B?UnJLaFRVTTRNTCtuQmd1aDRjTERxaW5KRGk5akZCTFcxVHVQMHliTUJLa0U4?= =?utf-8?B?UkRNYWRDcERhdzk4a0JtQTYvRitkaUVwRkM1aHpQQStUdDNkOWFUeG4yWmp0?= =?utf-8?B?TTBsb2VIZzU1czhuWVdUaVExNHAvSXFUYmorRzNodG1RTXVQK0c4ODZIbzVG?= =?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0+OCRwbq12ipyrYnSHP+5jgnKE5IbmUjP2q1BbrM6xu5ApmMM1H+JJ6/nUsk/Y7vlpKqGaD9AgQY6pgF8ypPdSMcyqoZnm81Uaioo16ZhGcqvGhSG398E5Vck4S7G2YR1gx05Ug6BAgQI/6EbWbroLkuVEggxLL1h2v30I5t/1S9no/KUDxebrvJ21tuAX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN6PR12MB2686;20:QJjzEkBQUFMrLo8r60vQITPaHKPkqm+hw957aCbs8kOaubkb6+eIjhwpIrokalgZbt7LPMLVgkUfdx1FARz5fr+BOIdzAvWqCP8jtS/rvWNK4plphXW4/PCWS9WJ0E40NlDW6rl/N0FnHui0tFVHrphtr+dd+dhYBapCQ3X11amNuO7R2wNZqlQGVnSOsGcdQdAXALzXVbMX3pVd9YdLu/J7EeAJC3VrLov75kbHgS0w/Hi9FA9jHzZsyXrtsaUT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2018 14:10:27.3237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b7d2add-154c-4e6e-b301-08d60e825659 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2686 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/29/2018 02:56 PM, Sean Christopherson wrote: > On Wed, Aug 29, 2018 at 01:24:00PM -0500, Brijesh Singh wrote: >> The following commit: >> >> 368a540e0232 (x86/kvmclock: Remove memblock dependency) > > Checkpatch prefers: > > Commit 368a540e0232 ("x86/kvmclock: Remove memblock dependency") > > That'll also save three lines in the commit message. Noted. > >> caused SEV guest regression. When SEV is active, we map the shared >> variables (wall_clock and hv_clock_boot) with C=0 to ensure that both >> the guest and the hypervisor is able to access the data. To map the > > Nit: s/is/are Noted. > >> variables we use kernel_physical_mapping_init() to split the large pages, >> but this routine fails to allocate a new page. Before the above commit, >> kvmclock initialization was called after memory allocator was available >> but now its called early during boot. > > What about something like this to make the issue a bit clearer: > > variables we use kernel_physical_mapping_init() to split the large pages, > but splitting large pages requires allocating a new PMD, which fails now > that kvmclock initialization is called early during boot. > Much better. >> Recently we added a special .data..decrypted section to hold the shared >> variables. This section is mapped with C=0 early during boot. Use >> __decrypted attribute to put the wall_clock and hv_clock_boot in >> .data..decrypted section so that they are mapped with C=0. >> >> Signed-off-by: Brijesh Singh >> Fixes: 368a540e0232 ("x86/kvmclock: Remove memblock dependency") >> Cc: Tom Lendacky >> Cc: kvm@vger.kernel.org >> Cc: Thomas Gleixner >> Cc: Borislav Petkov >> Cc: "H. Peter Anvin" >> Cc: linux-kernel@vger.kernel.org >> Cc: Paolo Bonzini >> Cc: Sean Christopherson >> Cc: kvm@vger.kernel.org >> Cc: "Radim Krčmář" >> --- >> arch/x86/kernel/kvmclock.c | 30 +++++++++++++++++++++++++----- >> 1 file changed, 25 insertions(+), 5 deletions(-) >> >> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c >> index 1e67646..08f5f8a 100644 >> --- a/arch/x86/kernel/kvmclock.c >> +++ b/arch/x86/kernel/kvmclock.c >> @@ -28,6 +28,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -61,8 +62,8 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); >> (PAGE_SIZE / sizeof(struct pvclock_vsyscall_time_info)) >> >> static struct pvclock_vsyscall_time_info >> - hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __aligned(PAGE_SIZE); >> -static struct pvclock_wall_clock wall_clock; >> + hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __decrypted __aligned(PAGE_SIZE); >> +static struct pvclock_wall_clock wall_clock __decrypted; >> static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); >> >> static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) >> @@ -267,10 +268,29 @@ static int kvmclock_setup_percpu(unsigned int cpu) >> return 0; >> >> /* Use the static page for the first CPUs, allocate otherwise */ >> - if (cpu < HVC_BOOT_ARRAY_SIZE) >> + if (cpu < HVC_BOOT_ARRAY_SIZE) { >> p = &hv_clock_boot[cpu]; >> - else >> - p = kzalloc(sizeof(*p), GFP_KERNEL); >> + } else { >> + int rc; >> + unsigned int sz = sizeof(*p); >> + >> + if (sev_active()) >> + sz = PAGE_ALIGN(sz); > > This is a definite downside to the section approach. Unless I missed > something, the section padding goes to waste since we don't have a > mechanism in place to allocate into that section, e.g. as is we're > burning nearly 2mb of data since we're only using 4k of the 2mb page. > And every decrypted allocation can potentially fracture a large page > since the allocator is unaware of the decrypted requirement. Might > not be an issue for kvmclock since it's a one-time allocation, but > we could suffer death by a thousand cuts if there are scenarios where > a decrypted allocation isn't be persistent (VirtIO queues maybe?). > The .data..decrypted is used for storing the static variables (which need to be accessed unencrypted before dynamical allocators are ready). If caller does a dynamic allocation and want to use the buffer as decrypted then she is responsible to set/clear the C-bit using set_memory_{decrypted,encrypted}. Currently, the decrypted section holds the wall_clock and hv_clock_boot variables but its user will grow when we add SEV-ES support. In SEV-ES case, the GHCB (guest-host communication block) need to be accessed unencrypted very early during boot. SEV uses SWIOTLB for DMA buffer, the buffer pool is allocated and mapped as decrypted during the boot. For the SEV case, Virtio uses the DMA APIs to allocate the VRING, caller does not need to map the buffers as decrypted. Actually there are very few number of set_memory_{decrypted/encrypted} calls overall (during or after the kernel boot). > Duplicating the full kernel tables for C=0 accesses doesn't suffer > from these issues. And I think potential corruption issues due to > mis-{aligned,size} objects can be detected through static analysis, > build assertions and/or runtime checks. > >> + p = kzalloc(sz, GFP_KERNEL); > > For the SEV case, can't we do a straight kmalloc() since we zero > out the page after decrypting it? > Sure we can do kmalloc(); IMO, since this is not hot code path and doing kmalloc() for SEV and kzalloc() for non-SEV does not buy much. >> + >> + /* >> + * The physical address of per-cpu variable will be shared with >> + * the hypervisor. Let's clear the C-bit before we assign the >> + * memory to per_cpu variable. >> + */ >> + if (p && sev_active()) { >> + rc = set_memory_decrypted((unsigned long)p, sz >> PAGE_SHIFT); >> + if (rc) >> + return rc; >> + memset(p, 0, sz); >> + } >> + } >> >> per_cpu(hv_clock_per_cpu, cpu) = p; >> return p ? 0 : -ENOMEM; >> -- >> 2.7.4 >>