Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753071AbdGXUKe (ORCPT ); Mon, 24 Jul 2017 16:10:34 -0400 Received: from mail-by2nam01on0071.outbound.protection.outlook.com ([104.47.34.71]:28576 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753290AbdGXUHI (ORCPT ); Mon, 24 Jul 2017 16:07:08 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: Thomas Gleixner , Borislav Petkov , Joerg Roedel , "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?q?=5C=22Radim=20Kr=C4=8Dm=C3=A1=C5=99=5C=22?= , Tom Lendacky , Brijesh Singh Subject: [RFC Part2 PATCH v3 17/26] KVM: SVM: Add support for SEV LAUNCH_MEASURE command Date: Mon, 24 Jul 2017 15:02:54 -0500 Message-Id: <20170724200303.12197-18-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170724200303.12197-1-brijesh.singh@amd.com> References: <20170724200303.12197-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0049.namprd12.prod.outlook.com (10.161.151.17) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef9e0194-259c-4ef3-9d10-08d4d2cf157a 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:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics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Yg4wRo1nRbD3GYStHZ6pSooDfgJSxGlqA3e4EKr5UJbkVmIPBg8+qCAHlfE0cHoR4CyD0He2AsgpMxCxymUT6XFvwPncMgXKfXv233U28ERweuV7yMpjljrQa22VHlVWvnredsrwdlJ91NSf4bqiXexJe3LrLIlLckGjMYxge5kqzfbxJ0ZbPw2Ogopv9HrBgZjnanj0pXNi8ovnMJthO1Q5K7TOjif9shgg4hMRjMhFdO+vb/YZWv96NYwrxu2xMXWpxi4r1pH5UoJSBCs8XtfC7MhWkVIkSuEc+CfwFfcygk8qgKmPXUswO5eFtxTRzZMd3YtncSh/x7ql4ylG/ggi4O7lj2OPVic+GMvjmrIrWi61wF5FKwtJW8HVUuPXLNDmoN8CxTfEZDZI= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:Bs2ui2FDG/4KmSbFFzuqLZy74Q6lY5o3Y7xMiHkID9SKOzTpsQPrIl+4MG1C6CNxLi/j78R1uWsxM/S12WQNDXlmqMM3t5lLq0CzSE0rk7DbQ5LAdbe9J9GsAMIpja3FID8tizSXHpgh4ra628vN+07nNAp6rlcawaCE6drURMoZnQWQmVwoLNAo6D6G164g77lXBsdzsSnUweX1ZbBtZfkC4LysCt99UNuBA27ycKrh8CrA2LcIhLP8bMxaqK6nR0dHI0DLK6PA/CHzD0MfO8Fmcvaja0nzuGn6QbGNOGpZi+C48lqGNFcwNYEf6UD5m9xTn8QZuO7qaoHc1E6wA9Zbhw/CKnFXJ2jNIwTgiK1f2VKPa9KrN7CM7YyvwWZl5jj1b+6dVwuNBk1xOxNfYNAsMsphFQ9+x0u72zGc7eAK/QNf91lwyaid+jHFjDAHcwJbFrSek6qsfwd5OFwshcj3dhpcwQBHKq+RPArozzp1ZMOiJrEa0lO8K5ci9QYt X-Exchange-Antispam-Report-Test: UriScan:(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)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR12MB0145;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;4:HiUt+GlsG3w4hBd5fh7ViVHzUDshVPVFwr7mLb9WeK?= =?us-ascii?Q?3vqrK4FNLPaD25T4hl4yDn4EERn60MqB9r52JXS+PwWKpFZz0alIVeECLmiN?= =?us-ascii?Q?u1/FhM5D+HhHeTPvxxKdfbnuYMj0o9Tl1FlmwfAwif/V9W68AF9azSPg8oJp?= =?us-ascii?Q?q8ZUs5JiYC+6DXvYk1FgTWwAZW79d7fhp5vqQkitSTL9JgE2VYJFvT7EEWnY?= =?us-ascii?Q?r/svqXvY5pfM0vuQSkNYrcD0MrmJ+3HMag54IO+l3VFgbx5HjgEOH3VomANW?= =?us-ascii?Q?FtKs+dnSttLK6oAe3DDv0tgtXlSMuYB8qj0h3hk/rIdH8iKsZmQ29FyvYxW1?= =?us-ascii?Q?HOs6JUzxmXG6ddOvmEIkYhUtr0o2iel7tZbdb0Sk98iwOsx8XJVc2uRKOuls?= =?us-ascii?Q?NtH+JcBtKTS9kjrA0d3CVsxzN59+JtN7zn2qGqYJfgPB/BVxtt5iGvZalqj0?= =?us-ascii?Q?F7X6QGzvpvCHjlrWRZspypjr3PvqF5PaaNqe9nrRlE9Y8M9pEDmInjn3nyMi?= =?us-ascii?Q?p7MDTWp5uV4OEPwRMKKqEH6fZMQpRiaHV5tmcLWIlZx5gOTntBq7REyKUVeY?= =?us-ascii?Q?Oei9tAAtqM29TOgMU5sYnYEMlw5RFpkwIPrPeVoMZUhQEwMM8wxr5fqOuBZb?= =?us-ascii?Q?d0yP/bp22mZWmv83s/LMzHh08BAxdtU2tvjB9TrBw9BNfkK5eTOFk/nj8f3u?= =?us-ascii?Q?be7HA5p/AFyxRQXxCxXxff42btDHfgBAKCpqMRv09T3YCw0vRiyFjYOX+CoG?= =?us-ascii?Q?0MdJbf7UKPFhtDEK3wneOlWEa/P/87/rt+J8HSiG9FYp8O5zniQ2mvo2mkC8?= =?us-ascii?Q?Df9AJkZjFa29amQkr3ROLtxdFcxnG5WsYL6GEBY7gLyQt7cBmxKQcAfzVPot?= =?us-ascii?Q?aZjlFNBy25W/N0sY/JpL7T6xKvjLlPQBLVji43kRTHQpL4FzclE+MlXyED2h?= =?us-ascii?Q?lIKBWYr5JVMJjVg64t1b0pIEcCDF/LgHDMchlY6+1HtGBgUzZlm8JRiYA4to?= =?us-ascii?Q?so3BI+aIe3waC+CTYsZSXqAGkByG6g3/redZiCmoRJlenrKlX9BpeZ0MArTE?= =?us-ascii?Q?2LK/9ltiyezAtD/Fdp5/B0WvaQPC2yRXT37cyUXm1WydozdvYd2S2xpeGETX?= =?us-ascii?Q?s4ICJfKnfJjeifz5FMPUIWlSfai2+TAeqmFcM8MjsSX8a2DMXvCafctNWF6E?= =?us-ascii?Q?ledD9whglrt9VnVWLaq4ITHyZLo+sk1DId?= X-Forefront-PRVS: 0378F1E47A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39860400002)(39840400002)(189002)(199003)(7350300001)(68736007)(53416004)(105586002)(54906002)(97736004)(50466002)(6486002)(48376002)(2906002)(106356001)(33646002)(6116002)(1076002)(53936002)(3846002)(189998001)(101416001)(6666003)(2950100002)(478600001)(50986999)(76176999)(81156014)(50226002)(38730400002)(47776003)(5003940100001)(86362001)(25786009)(4326008)(36756003)(42186005)(8676002)(81166006)(110136004)(5660300001)(66066001)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0145;H:ubuntu-010236106000.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR12MB0145;23:RM59ON09Tgvh4jgWhOsE9iuP3vJxb+ze4DJKyjmZm?= =?us-ascii?Q?aP1b23/Kb+jR/LKsrfsK5E8uOTsagH9+4cLbEzC0CMJHRJv1grqJwGnxwm50?= =?us-ascii?Q?ANCRdvF2Hdm2j4CXsppD7WBCW9rU26CXAQlZtfimDbiQEWPvXrAkUfAB6X3P?= =?us-ascii?Q?p67poze7OnsoGxS49TFmMMyJKBTb5GjD2SCs/df+u31UkF4Ngk1lgi7Fzhb0?= =?us-ascii?Q?M93p9dJRmrFNYDvM3jpBVU+h2J9VUU6ZhlqCgyP9s89QfcM2pTJjphlnJkcb?= =?us-ascii?Q?wtSv4TgB4iBCDfmeoe/dNa2tJRk1mMnTVb9i/W3/cmL9R/YdqaMTWTF84aD8?= =?us-ascii?Q?DUboymeXh25YdQxN5asiGaXJjbdqt/DEzE/Lx+vQEojJJ2L2HoE7oOZnFWUH?= =?us-ascii?Q?LKWT2vk3ZyR0Q0wr8nDoT7wjKyZCRJXLlh05XcyMADTDbmvUOPe3Gmg0pJoL?= =?us-ascii?Q?bLYgVChMjc6gtVg+fltg55iRU7jx+vHS6oRCkPJBptdATWEJBv4JE55bDJH1?= =?us-ascii?Q?pdlo+D52zvuhdCrOZKljkTonh4Q4unuCdfItwSKwpAy3Aa2Z7okEMaiKhdTI?= =?us-ascii?Q?KgH9mx9IpQm3Qg2Tk1oOBBLo+A2+wjfEahx6OPFOeRDTIEKorC3EOHthS8c5?= =?us-ascii?Q?S2s39mNt0pToPUApNtjdUbT5MUtU16masC5NAUd5/mCnj471NoqMWqUssRN5?= =?us-ascii?Q?WzvWjlpReYksPloAa7LQX5p/gpsWUJe/xfROF8y0cIdrDu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ZQMbD4U02EE3medmPwkoZU4NOkBpsYv92DHLfeCsNLh/4Qe4L1VEvEMTSbfjAzxlLBJCfvJSOIO+gfEO5HmNb5BSuK+GNsTWnap/4C/p1KsPbbLyL9TqHuzPREjKgOQt9MfI85TlXoRrZzIL43wbrXsh2C7VADnb2MCfwAdJUB9f4UQ45c3gzaUGAP9yZrC3t1qXH9ErEakeiXBoPZ63rr/2FUBioVF3UQ+hGKkonS+MxTiBDhiOhKehVbXSFkc/zsFYwU4JBwvY1aqz6k/a+b7DOEBgE8ze1wS7AuC5f0= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0145;20:/Dv7hqNVSf1g/7m1HtLw19BNhdzYaMloogh2DYiKhRtq/GucwiDKTWDgkenFIve1XXpvU5JNAga2tiR6SPAyWRjeS6VYIFz+uDA1pR03zHNC9lcSiEpm3qP2wrM6r4G8fd+D47a4Fk3+xNpXNhAFdYEy8VmZZi6jN3teM5kb2FKhbzhPix7wAZF1xfhFDEzKjJ1ylu+doHGocpg0LfXPxlNnDoCBcvd2aE7KVtl9rfsDu7qu4yKZvHbmcujfiWPx X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2017 20:03:41.6971 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2093 Lines: 81 The command is used to retrieve the measurement of memory encrypted through the LAUNCH_UPDATE_DATA command. This measurement can be used for attestation purposes. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 91b070f..9b672eb 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -5957,6 +5957,54 @@ static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp) return ret; } +static int sev_launch_measure(struct kvm *kvm, struct kvm_sev_cmd *argp) +{ + struct sev_data_launch_measure *data = NULL; + struct kvm_sev_launch_measure params; + void *addr = NULL; + int ret; + + if (!sev_guest(kvm)) + return -ENOTTY; + + if (copy_from_user(¶ms, (void *)argp->data, + sizeof(struct kvm_sev_launch_measure))) + return -EFAULT; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + if (params.address && params.length) { + ret = -EFAULT; + addr = kzalloc(params.length, GFP_KERNEL); + if (!addr) + goto e_free; + data->address = __psp_pa(addr); + data->length = params.length; + } + + data->handle = sev_get_handle(kvm); + ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_MEASURE, data, &argp->error); + + /* copy the measurement to userspace */ + if (addr && + copy_to_user((void *)params.address, addr, params.length)) { + ret = -EFAULT; + goto e_free; + } + + params.length = data->length; + if (copy_to_user((void *)argp->data, ¶ms, + sizeof(struct kvm_sev_launch_measure))) + ret = -EFAULT; + +e_free: + kfree(addr); + kfree(data); + return ret; +} + static int svm_memory_encryption_op(struct kvm *kvm, void __user *argp) { struct kvm_sev_cmd sev_cmd; @@ -5980,6 +6028,10 @@ static int svm_memory_encryption_op(struct kvm *kvm, void __user *argp) r = sev_launch_update_data(kvm, &sev_cmd); break; } + case KVM_SEV_LAUNCH_MEASURE: { + r = sev_launch_measure(kvm, &sev_cmd); + break; + } default: break; } -- 2.9.4