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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCB74C433F5 for ; Mon, 18 Oct 2021 19:18:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D79161356 for ; Mon, 18 Oct 2021 19:18:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5D79161356 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 62D72900003; Mon, 18 Oct 2021 15:18:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B5AD900002; Mon, 18 Oct 2021 15:18:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4300F900003; Mon, 18 Oct 2021 15:18:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 31017900002 for ; Mon, 18 Oct 2021 15:18:22 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DBD421812B850 for ; Mon, 18 Oct 2021 19:18:21 +0000 (UTC) X-FDA: 78710519202.15.C0CB628 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf12.hostedemail.com (Postfix) with ESMTP id 3849A10000AA for ; Mon, 18 Oct 2021 19:18:16 +0000 (UTC) Received: from zn.tnic (p200300ec2f085700af6a7a3215758573.dip0.t-ipconnect.de [IPv6:2003:ec:2f08:5700:af6a:7a32:1575:8573]) (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 CA2981EC04A9; Mon, 18 Oct 2021 21:18:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1634584693; 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=H0D9fMYiemWaywKhrFeRx22doUmAUI5poz1BHecVEck=; b=aaPBSilQLVoxx5ZYTymlL1LpcFbbTPdvT1VQjLz4BWf9YVHrCwCMueZkzHVjXeysrg0/eo EpZ0n8bosyKFGw3HgTiyge1sVQRj2H/scBFwyVzUsSGSBApNBZPU/wVXSMAAfNGzdpIW8A e30476Q54MX2AXNg4o+ioUpfa98cro8= Date: Mon, 18 Oct 2021 21:18:13 +0200 From: Borislav Petkov To: Michael Roth Cc: Brijesh Singh , 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 , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 08/42] x86/sev-es: initialize sev_status/features within #VC handler Message-ID: References: <20211008180453.462291-1-brijesh.singh@amd.com> <20211008180453.462291-9-brijesh.singh@amd.com> <20211018184003.3ob2uxcpd2rpee3s@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211018184003.3ob2uxcpd2rpee3s@amd.com> X-Rspamd-Queue-Id: 3849A10000AA X-Stat-Signature: 48paqeysessq4arh4k3fjhy31g9y6bc5 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=alien8.de header.s=dkim header.b=aaPBSilQ; dmarc=temperror reason="query timed out" header.from=alien8.de (policy=temperror); spf=pass (imf12.hostedemail.com: domain of bp@alien8.de designates 5.9.137.197 as permitted sender) smtp.mailfrom=bp@alien8.de X-Rspamd-Server: rspam02 X-HE-Tag: 1634584696-579763 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 Mon, Oct 18, 2021 at 01:40:03PM -0500, Michael Roth wrote: > If CPUID has lied, that would result in a #GP, rather than a controlled > termination in the various checkers/callers. The latter is easier to > debug. > > Additionally, #VC is arguably a better indicator of SEV MSR availability > for SEV-ES/SEV-SNP guests, since it is only generated by ES/SNP hardware > and doesn't rely directly on hypervisor/EFI-provided CPUID values. It > doesn't work for SEV guests, but I don't think it's a bad idea to allow > SEV-ES/SEV-SNP guests to initialize sev_status in #VC handler to make > use of the added assurance. Ok, let's take a step back and analyze what we're trying to solve first. So I'm looking at sme_enable(): 1. Code checks SME/SEV support leaf. HV lies and says there's none. So guest doesn't boot encrypted. Oh well, not a big deal, the cloud vendor won't be able to give confidentiality to its users => users go away or do unencrypted like now. Problem is solved by political and economical pressure. 2. Check SEV and SME bit. HV lies here. Oh well, same as the above. 3. HV lies about 1. and 2. but says that SME/SEV is supported. Guest attempts to read the MSR Guest explodes due to the #GP. The same political/economical pressure thing happens. If the MSR is really there, we've landed at the place where we read the SEV MSR. Moment of truth - SEV/SNP guests have a communication protocol which is independent from the HV and all good. Now, which case am I missing here which justifies the need to do those acrobatics of causing #VCs just to detect the SEV MSR? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette