Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp583889pxk; Wed, 16 Sep 2020 11:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydF4w+A34zT5KzNKTztm43ZHFCizWMyqireUM7EZD3rhUFQLSO70nltMefwR87vmbGPDV/ X-Received: by 2002:a50:9fa1:: with SMTP id c30mr28408159edf.207.1600280670329; Wed, 16 Sep 2020 11:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600280670; cv=none; d=google.com; s=arc-20160816; b=Su9MhKBoyltbo2eQbWkjdD6wM2+K5c1VOZmwggzO5/WLF16AfIknX/+o+RN+vQwCZE zX025eFGPzSg5RvBlGiON7ckd1OL6DAcbfpfb/CXahMQPmsvBfVwMBCj2iOqeOaO/kXM t3MDCcBsa2y8nHbrD3p0tEFaFVZnxd95kpzN/ZDosRsX81mhs3EArVik3VSiSe6jI9I1 4GqZs0Yh6pXnfqeCpEnWRuIohbQoJiDrP9gOVuISZGRDwhxYvjzodiGrR7qHo8FCS68B GXRdOSZNAlQX1bcOKMWGO4OT9Tv6I3cdBUIHOEdBDgZXMMFEW9ekGmhyQASVoxfcMLlJ TI3g== 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=RN8C300FLFTKGnK4rCKKlvdu+MmJhPRruCvruK9Qns4=; b=vAaWs3aFzoZI35v5ng9ze/b0jRxFetoDrp5eyjf6PFdPgmPDaEDApXrvgFlNdjAomq 2d8WVoiBi8sncs0uKg4J8/xyXV0KnPRsb5PHN/oe/dGzuToGicqL+y9wuyYNfDLMVMp3 7F6UxTOb3jj/2FS3ovouqhldaufhda1W0QFlnW7n3AU1mZkr+1T38N/9omyrZi5R2Z6P A4pXgfz3bfdf6Gr8HA7hIoOWv5BC1h7Xc2S/3VxJdTRgfUHf20zRpYmDjDoKidj8E3MR 0Oxk+p1LdSkbBREpvP04b8FqBZtJUuHyBsVG1lSMwpExRFrqX2kvqqWwHSe5Z6sDSJGA cBiw== 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 jp7si11974857ejb.742.2020.09.16.11.24.07; Wed, 16 Sep 2020 11:24:30 -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 S1727717AbgIPSWP (ORCPT + 99 others); Wed, 16 Sep 2020 14:22:15 -0400 Received: from mga05.intel.com ([192.55.52.43]:25895 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727760AbgIPSVZ (ORCPT ); Wed, 16 Sep 2020 14:21:25 -0400 IronPort-SDR: 8ukguTZ4f1SUug5kzNE/8Ka8JAbyG3vB86Y9wbTR26TADdkjR1DOhhQ7NI3w8h6Vrg/JPRKAS9 0qA5OVik9jcw== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="244340747" X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="244340747" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 09:02:36 -0700 IronPort-SDR: RvbkOg0yPbL+k8A0PRubgOPsxVaYPCXIBn/0cAgKLZlM/vFjE6hK5kcCxnDDSM6eii/skUQ0Lt M+Blt9qb3T7g== X-IronPort-AV: E=Sophos;i="5.76,433,1592895600"; d="scan'208";a="288402007" 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; 16 Sep 2020 09:02:34 -0700 Date: Wed, 16 Sep 2020 09:02:12 -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: <20200916160210.GA10227@sjchrist-ice> References: <58093c542b5b442b88941828595fb2548706f1bf.1600114548.git.thomas.lendacky@amd.com> <20200914212601.GA7192@sjchrist-ice> <20200915163010.GB8420@sjchrist-ice> <5e816811-450f-b732-76f7-6130479642e0@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e816811-450f-b732-76f7-6130479642e0@amd.com> 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 Wed, Sep 16, 2020 at 10:11:10AM -0500, Tom Lendacky wrote: > On 9/15/20 3:13 PM, Tom Lendacky wrote: > > On 9/15/20 11:30 AM, Sean Christopherson wrote: > >> 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? > > > > Almost anything can be done with software. It would require a lot of > > hypervisor and guest code and changes to the GHCB spec, etc. So given > > that, probably just the check for arch.guest_state_protected is enough for > > now. I'll just need to be sure none of the debugging paths can be taken > > before the VMSA is encrypted. > > So I don't think there's any guarantee that the KVM_SET_GUEST_DEBUG ioctl > couldn't be called before the VMSA is encrypted, meaning I can't check the > arch.guest_state_protected bit for that call. So if we really want to get > rid of the allow_debug() op, I'd need some other way to indicate that this > is an SEV-ES / protected state guest. Would anything break if KVM "speculatively" set guest_state_protected before LAUNCH_UPDATE_VMSA? E.g. does KVM need to emulate before LAUNCH_UPDATE_VMSA? > How are you planning on blocking this ioctl for TDX? Would the > arch.guest_state_protected bit be sit earlier than is done for SEV-ES? Yep, guest_state_protected is set from time zero (kvm_x86_ops.vm_init) as guest state is encrypted/inaccessible from the get go. The flag actually gets turned off for debuggable TDX guests, but that's also forced to happen before the KVM_RUN can be invoked (TDX architecture) and is a one-time configuration, i.e. userspace can flip the switch exactly once, and only at a very specific point in time.