From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 824D8C433F5 for ; Fri, 4 Mar 2022 14:06:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DF878D0002; Fri, 4 Mar 2022 09:06:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 08F328D0001; Fri, 4 Mar 2022 09:06:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4BEA8D0002; Fri, 4 Mar 2022 09:06:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id D42008D0001 for ; Fri, 4 Mar 2022 09:06:57 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 9EA541210D7 for ; Fri, 4 Mar 2022 14:06:57 +0000 (UTC) X-FDA: 79206880074.03.9447EA2 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf21.hostedemail.com (Postfix) with ESMTP id 16E801C0031 for ; Fri, 4 Mar 2022 14:06:54 +0000 (UTC) Received: from nazgul.tnic (dynamic-002-247-252-111.2.247.pool.telefonica.de [2.247.252.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BA9F91EC032C; Fri, 4 Mar 2022 15:06:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1646402809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=neT0UiN3Ufi1LjeuMTNM4SQxn8WU0bORQpO1LvG3ruw=; b=ChTyt7PGK//kdRXY9IGRBXoPzoUFM3dYdgso/XV4M9ByjglGyB+yHbrK5Cd1ZZDGeVz6zh 2c1Uy5t+zgwzRCehtxV4Nav/6NYzlEarmnYDzMm4iqTg4moW2c5FxAr+romAataWivvaiP ZUu7NoPkX5UaB9oYsHkQGxYhEHBIIV8= Date: Fri, 4 Mar 2022 15:06:49 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v11 44/45] virt: sevguest: Add support to get extended report Message-ID: References: <20220224165625.2175020-1-brijesh.singh@amd.com> <20220224165625.2175020-45-brijesh.singh@amd.com> <7c562d34-27cd-6e63-a0fb-35b13104d41f@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7c562d34-27cd-6e63-a0fb-35b13104d41f@amd.com> X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 16E801C0031 X-Stat-Signature: e4atjeizy5ijj6f9c9ixotdhm5q4qd6m Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=ChTyt7PG; dmarc=pass (policy=none) header.from=alien8.de; spf=pass (imf21.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de X-HE-Tag: 1646402814-488209 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 03, 2022 at 10:47:20AM -0600, Brijesh Singh wrote: > I did not fail on !req.cert_len, because my read of the GHCB spec says that > additional data (certificate blob) is optional. A user could call > SNP_GET_EXT_REPORT without asking for the extended certificate. In this > case, SNP_GET_EXT_REPORT == SNP_GET_REPORT. > > Text from the GHCB spec section 4.1.8 > --------------- > https://developer.amd.com/wp-content/resources/56421.pdf > > The SNP Extended Guest Request NAE event is very similar to the SNP Guest > Request NAE event. The difference is related to the additional data that can > be returned based on the guest request. Any SNP Guest Request that does not > support returning additional data must execute as if invoked as an SNP Guest > Request. > -------------- Sorry, it is still not clear to me how "without asking for the extended certificate" == !req.certs_len That's not explained in the help text either. And ->certs_len is part of the input structure but nowhere does it say that when that thing is 0, the request will be downgraded to a SNP_GET_REPORT. How is the user of this supposed to know? And regardless, you can still streamline the code as in the example I gave so that it is clear which values are checked and for which does the request get failed... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette