Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3114164pxk; Tue, 15 Sep 2020 10:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWxhNdzFFmRs24braBZMOaf0q/mNX6KkBQiPF67242ubQwpNgAZhsVuSDflH//wljz6RD/ X-Received: by 2002:a17:906:28c4:: with SMTP id p4mr21078597ejd.345.1600190499392; Tue, 15 Sep 2020 10:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600190499; cv=none; d=google.com; s=arc-20160816; b=V24ybP9TqRiZkhUx3k1ZclvX46rKqeGjrHDIloKdS1exxAIgLkCByIyl3phzti6fn6 qFeCtAloD4VdjwK9cjkdowIueF4t2OS3El0aTtWp7bMS5V6HgiNCGKItnYTKiMLFhkId v91QcJzwCVYZKq+WY26/VwYItYgkg/uGdhXxvxBnmMYVQwAko9M9OVQfF4EPVfW3hzRh z79s2/R/X4DQXyf7SJxra5cYVyy6/iNCJxjX82ehPywaNei0rLPpocur1W0zXg9pGENC 5kmq+ZFDN/cySF5RgDLDAb0yNenNlvocIWivTHRA6VB08NOPgiQqnp4WY2s+dkrgY9KF 9how== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=w0rReFnJ8nM80TB6jzWMiSM6foSTvisQy0Ymg9uxQzg=; b=nwEljo58JQw5keR6VCtXas7GxyC5UpNmByeasrd+4RdZFahVVYm5KqBSHvE4B96843 4sGYQ1akslQazAE6qkJ3kMTzjvchriMeri0CJZXIplhQzoxvvZOL1ziE2y66ceNhkbRi nTj1B79IkFgm5qMXOs6FLpMiyk61GXfZF6f8XKD4qQWwPXpjlaKPmYoV5dIHsFsFRQ61 KZ1d9WZeDGlTjbZxrY3tvQQiSsLRi9S7Rt7/CFhFcQpg1YC/oU0pX6qL/L2XPAVCacRm GgpyWGlD6UekwLkIsGI6kCOh42nK3qxbvbX3FAVUPzTXwvctXDcUsBCAgjqMWtRIa33l rFhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d22si10226093edz.234.2020.09.15.10.21.16; Tue, 15 Sep 2020 10:21:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgIORUf (ORCPT + 99 others); Tue, 15 Sep 2020 13:20:35 -0400 Received: from mga12.intel.com ([192.55.52.136]:63720 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727537AbgIOQaz (ORCPT ); Tue, 15 Sep 2020 12:30:55 -0400 IronPort-SDR: MfjOib9TbUe/tuATOYbbh13vwUL/HHaexPHNLpz3U5mzV0/QXeoI5B1ALoAybTIXrwG20I2myV ZFSrc/MAQC0g== X-IronPort-AV: E=McAfee;i="6000,8403,9745"; a="138802074" X-IronPort-AV: E=Sophos;i="5.76,430,1592895600"; d="scan'208";a="138802074" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2020 09:30:14 -0700 IronPort-SDR: FjsqJk6wUJ2aGTolsZm+KpI+O4OmPL1HznU8jd0bAMqc+xAHRfulpM5MkI6xQ02maeAfxTlFtC x7DRG/Psz2tg== X-IronPort-AV: E=Sophos;i="5.76,430,1592895600"; d="scan'208";a="288053125" Received: from sjchrist-ice.jf.intel.com (HELO sjchrist-ice) ([10.54.31.34]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2020 09:30:13 -0700 Date: Tue, 15 Sep 2020 09:30:10 -0700 From: Sean Christopherson To: Tom Lendacky Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Jim Mattson , Joerg Roedel , Vitaly Kuznetsov , Wanpeng Li , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Brijesh Singh Subject: Re: [RFC PATCH 08/35] KVM: SVM: Prevent debugging under SEV-ES Message-ID: <20200915163010.GB8420@sjchrist-ice> References: <58093c542b5b442b88941828595fb2548706f1bf.1600114548.git.thomas.lendacky@amd.com> <20200914212601.GA7192@sjchrist-ice> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 08:37:12AM -0500, Tom Lendacky wrote: > On 9/14/20 4:26 PM, Sean Christopherson wrote: > > On Mon, Sep 14, 2020 at 03:15:22PM -0500, Tom Lendacky wrote: > >> From: Tom Lendacky > >> > >> Since the guest register state of an SEV-ES guest is encrypted, debugging > >> is not supported. Update the code to prevent guest debugging when the > >> guest is an SEV-ES guest. This includes adding a callable function that > >> is used to determine if the guest supports being debugged. > >> > >> Signed-off-by: Tom Lendacky > >> --- > >> arch/x86/include/asm/kvm_host.h | 2 ++ > >> arch/x86/kvm/svm/svm.c | 16 ++++++++++++++++ > >> arch/x86/kvm/vmx/vmx.c | 7 +++++++ > >> arch/x86/kvm/x86.c | 3 +++ > >> 4 files changed, 28 insertions(+) > >> > >> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > >> index c900992701d6..3e2a3d2a8ba8 100644 > >> --- a/arch/x86/include/asm/kvm_host.h > >> +++ b/arch/x86/include/asm/kvm_host.h > >> @@ -1234,6 +1234,8 @@ struct kvm_x86_ops { > >> void (*reg_read_override)(struct kvm_vcpu *vcpu, enum kvm_reg reg); > >> void (*reg_write_override)(struct kvm_vcpu *vcpu, enum kvm_reg reg, > >> unsigned long val); > >> + > >> + bool (*allow_debug)(struct kvm *kvm); > > > > Why add both allow_debug() and vmsa_encrypted? I assume there are scenarios > > where allow_debug() != vmsa_encrypted? E.g. is there a debug mode for SEV-ES > > where the VMSA is not encrypted, but KVM (ironically) can't intercept #DBs or > > something? > > No, once the guest has had LAUNCH_UPDATE_VMSA run against the vCPUs, then > the vCPU states are all encrypted. But that doesn't mean that debugging > can't be done in the future. I don't quite follow the "doesn't mean debugging can't be done in the future". Does that imply that debugging could be supported for SEV-ES guests, even if they have an encrypted VMSA?