Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp441872pxj; Wed, 16 Jun 2021 06:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbDd+hQCgzVfD5ueBvzZeBAMq+m0w12jC6DbtKe0/sq6CRJNar4nb5m5KhZzlLrknB9zqK X-Received: by 2002:a5d:914f:: with SMTP id y15mr3720776ioq.196.1623848861251; Wed, 16 Jun 2021 06:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623848861; cv=none; d=google.com; s=arc-20160816; b=kG+NkvYCIl0BXW15uOeJ1D/Sfa7xo95MVJEuvjKfHa4v0zp9czkgS0K+4ETIuJwSXl SZRY0IN+KeEL+kDbNulGhl5sCrwMScf6oIeZw3Jp3OFIqtGdjm4FeDVy1Zsg/flK4+CG wRAiVH8sXyUYjZmFtrK8rF7/GcSPlQlL7Uzi3he7O9QdIZ2K2/kxTLVshO3KPgOPhQQR tLQsKL7ZbWQBB7e4T2IjmXe7bTwTWsI27rD8jGiYQuOYAV7CPZqLEdx4ym59qbpftfbA QcLmt3aNQlRfLWfUO0xmdal2Nu+1WAXV7H6SJcBLAe/rBSEHpm497aUf01H1UNhxNGIg LasA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=4FsZ+W5sZrXednhxFcSgtJDgo1UvbrnapydD3pMYxu0=; b=bmsYMZxFeg//oDmepdo4CowPRuV+FoXc1k7RaVp+Bnq6xS/K24Dpv+wftQQRcLPKxE O/wwz/DWE4mfyj3WA3EBk3OlYUiGm3FQuXwpbY7E+dFWht5+G0Cj8SIbO7wvpigathIF bdpvb96t9wQ3edJx8gl7N8+Flkci2p2vhx6v8sqU5JMRLAA0PcLkVmI3bbl/9+6Sw3MS mvO0FDRX0Yc1KeSigfW94LnAzbRLcNon9kzmQuiH4U5AsXS9tXch5tzaiVMJJzeYFANY WTKcDrtY4j//6n0bfWXzY0o3Utj7zlQnA4F4hDUMfLCq+ra3zRiUHMBA7IPM2AY0/MiY dJXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SbnoJVFb; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si2305181ilk.84.2021.06.16.06.07.13; Wed, 16 Jun 2021 06:07:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SbnoJVFb; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233227AbhFPNJG (ORCPT + 99 others); Wed, 16 Jun 2021 09:09:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46309 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbhFPNJC (ORCPT ); Wed, 16 Jun 2021 09:09:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623848816; 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: in-reply-to:in-reply-to:references:references; bh=4FsZ+W5sZrXednhxFcSgtJDgo1UvbrnapydD3pMYxu0=; b=SbnoJVFbPc5m3jCfd3MfFq2/voG3/eKBafj6zQrzQ2K0/I5sr24JLyXz7iYGKn79hrhPIP F7vzhX9mVE5BUH25HHwyh1ihfYiAi/yLv/HwklIECiDwzSQ0C4xgJ3JM2X86NjuNwkKpn7 5SdknqJzhttPYRokwApNi9imHBNGmeA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-sU_-JDyPP9G0uvfGozhLNg-1; Wed, 16 Jun 2021 09:06:55 -0400 X-MC-Unique: sU_-JDyPP9G0uvfGozhLNg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BAC9E801B3E; Wed, 16 Jun 2021 13:06:51 +0000 (UTC) Received: from work-vm (ovpn-115-42.ams2.redhat.com [10.36.115.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA5666062C; Wed, 16 Jun 2021 13:06:44 +0000 (UTC) Date: Wed, 16 Jun 2021 14:06:42 +0100 From: "Dr. David Alan Gilbert" To: Brijesh Singh Cc: Borislav Petkov , 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, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , tony.luck@intel.com, npmccallum@redhat.com Subject: Re: [PATCH Part1 RFC v3 11/22] x86/sev: Add helper for validating pages in early enc attribute changes Message-ID: References: <20210602140416.23573-1-brijesh.singh@amd.com> <20210602140416.23573-12-brijesh.singh@amd.com> <70db789d-b1aa-c355-2d16-51ace4666b3f@amd.com> <9f012bcb-4756-600d-6fe8-b1db9b972f17@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9f012bcb-4756-600d-6fe8-b1db9b972f17@amd.com> User-Agent: Mutt/2.0.7 (2021-05-04) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org * Brijesh Singh (brijesh.singh@amd.com) wrote: > > On 6/16/21 7:03 AM, Borislav Petkov wrote: > > On Wed, Jun 16, 2021 at 06:00:09AM -0500, Brijesh Singh wrote: > >> I am trying to be consistent with previous VMGEXIT implementations. If > >> the command itself failed then use the command specific error code to > >> tell hypervisor why we terminated but if the hypervisor violated the > >> GHCB specification then use the "general request termination". > > I feel like we're running in circles here: I ask about debuggability > > and telling the user what exactly failed and you're giving me some > > explanation about what the error codes mean. I can see what they mean. > > > > So let me try again: > > > > Imagine you're a guest owner and you haven't written the SNP code and > > you don't know how it works. > > > > You start a guest in the public cloud and it fails because the > > hypervisor violates the GHCB protocol and all that guest prints before > > it dies is > > > > "general request termination" > > > The GHCB specification does not define a unique error code for every > possible condition. Now that we have reserved reason set 1 for the > Linux-specific error code, we could add a new error code to cover the > cases for the protocol violation. I was highlighting that we should not > overload the meaning of GHCB_TERM_PSC. In my mind, the GHCB_TERM_PSC > error code is used when the guest sees that the hypervisor failed to > change the state . The failure maybe because the guest provided a bogus > GPA or invalid operation code, or RMPUPDATE failure or HV does not > support SNP feature etc etc. But in this case, the failure was due to > the protocol error, and IMO we should not use the GHCB_TERM_PSC. > Additionally, we should also update CPUID and other VMGEXITs to use the > new error code instead of "general request termination" so that its > consistent. > > > If you still think that GHCB_TERM_PSC is valid here, then I am okay with it. I'd kind of agree with Borislav, the more hints we can have as to the actual failure reason the better - so if you've got multiple cases where the guest thinks the hypervisor has screwed up, find a way to give an error code to tell us which one. Dave > -Brijesh > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK