Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp20537lqa; Fri, 26 Apr 2024 12:57:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUT5XKt+EhqUKIMLbrOt+N/xi5q5KSmmkxPRnrc3e4tOUP6jZb8rUzNjPrF2Vke2XxBrlWKzR4X2QypNAniIVWnpf4APAHpKSzVBmmkfQ== X-Google-Smtp-Source: AGHT+IGzY2/nTNKGwFHM28G4kl+iUCsAgYjOZLUKbKpH66WPJu85eThL7ezjZWeZvKmQYVymdS3Z X-Received: by 2002:a05:620a:22b:b0:78a:6bfc:1b06 with SMTP id u11-20020a05620a022b00b0078a6bfc1b06mr4244730qkm.67.1714161438688; Fri, 26 Apr 2024 12:57:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714161438; cv=pass; d=google.com; s=arc-20160816; b=I412WSr0pxi/MWUUYiUvUzzTl1IYhgwM7ohInKmvvyR8lgad3JLIYE/WEj+HZbFPqp UjiYvu+QxBNFg9iqg8TW9XvKSbKUpyWzD9jJGIR2xC1nKnjXM9lMUlIRtEY0k/04hZJQ A6Ih8PpHyGwOKWRcsgXX353P8WMbZGLXBoz/6rwHhw5cfwugIZ1SLVTZl3urRdUa38yN HeQqLYq9kDmcI+Yn3t1Zkaqk1Pleq7L85A2xci9sUy6EVPtAaEUahriS2hll3pgCyKDA 8evmTn9j6pGyEsC+NX/XAESzCzwKcGKHXHxhBk25iEyrtrB6fEHMJwGk8y0TRWeRoTt9 Ql1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=7JHOwynv12T0Y/tQm4DZx8daXixOsghTKfdQCt+IwUg=; fh=RM9ilXmSUpBCwfE3NPBD8DmLGqqJ9inDsyPO8GVZGzM=; b=z0QFXkxDRdDzrsOTZPF38c5FYaWISDDRzvr7bBsZX3R5f3iVTl3f1hpctF+KLLlK0r C6qAUiWhgRzsH7Vn0wAlM4rMG54yELB1USA30KHLpcdT3YBfz2+685Twleco+8Ji7KVg Mj+f5yvxRj36VyqXQrHg8E7vw2PRfI9D+L21yMHfTGP4vq0m5cvv7R/iCksoOzEcC0Wn ALJItNccQHGubt0LSukX665mjB+YTE/rXmibUH4SgT7NEs3RhIqME5H/4S6XdQYXGvyj gGv7/1upfvITUbrtjunqgaxYPRSayZ83lgu0wpo56fLEUG6Cy2CjkYoko7eEjGIGDbqK X3nQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DUJoHdQg; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-crypto+bounces-3894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id de18-20020a05620a371200b007906fe56534si15822777qkb.226.2024.04.26.12.57.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 12:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DUJoHdQg; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-crypto+bounces-3894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4A4641C22793 for ; Fri, 26 Apr 2024 19:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E19D2137E; Fri, 26 Apr 2024 19:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DUJoHdQg" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A46A208CA for ; Fri, 26 Apr 2024 19:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714161432; cv=none; b=SlyNUnPZn6PN/u2fiapymXvEsiXI3r51nLQUi8RoUP2EYGxramYOeYsEtVT73BOdBJE8H9v6jJF3atXjglaoZQJR+pHHqVhUG0v3oVBznPzhTLTVexfKageXDZ1t0z8boWKS8uFVJ0WsAFcOnBd4JMY04IQoYjiyxVNZcwT2YkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714161432; c=relaxed/simple; bh=4Tl6Q7eOW4o1xylpHfLT20dEfliDc3ACOmwo+d+76q8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sl3qHIAXzbyR9ldWv6zliZgznq2US2XbNsXGcisBbKpOmCyvTzKH665Qae30cRYK8OrK3RYfhzRJxZyTfJdA6yxafTtzEnsm/Udm/Jl9rUm1IyZwwsv0AmaTLhI1ieqRBvsoljcTz7o6h4WQBODCJ72RJX1B4+RNTBBu5fCrN24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=DUJoHdQg; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61babe30125so14143927b3.0 for ; Fri, 26 Apr 2024 12:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714161430; x=1714766230; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=7JHOwynv12T0Y/tQm4DZx8daXixOsghTKfdQCt+IwUg=; b=DUJoHdQgSkNEv5FFc8d+51AkMU+KSLEf78ghN7IpvWkZ5WN1FWM6w5GzUr2KJKHUbr xAo42I0B9Jqc/lZeeIx3HPSVaoNuOqcqpRY8wonTdKJM6ER64qrQ+CYXuvETyBK4n8I8 COoXCR10OC7ZU3ShH9dzB9wgVdWV6wqXO/dSLeNWhjbKuXxkzO0iyHg8Ad6iuI1CcOP7 EiYsnfGWMAb4YNxPTjAyhtIgSIsGvYNaFwZpHpNqd7yG6nlhAtrx6VmwaxIXxLR/wPcY 9OGStJ5EAuG7qgqV10d/7DDMve6LOSUA1dAynGbSieZYe4PVCorFHfPkzhCHgjtTmMbf 8dyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714161430; x=1714766230; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7JHOwynv12T0Y/tQm4DZx8daXixOsghTKfdQCt+IwUg=; b=qS5hchKgiXh6Jpk1QdjefH2rSlUt9LT/GuED5zracLq+Qch9X3rlYP0+db1Jj82SpA OMxOBZnuDo92rxafW3H6itXH0bOo7mwoW/0mZlyTT2J089NxyldANddKyXLRGUo143dv vX9wC+gtW96emu0OF1owr1i5yqPpmNmkTqM9NppDv6gd+ynQ1T1WOfn80O3GPT/rEyor k2yaTlfKF1SztatS9kNq4hjdbfjgNeU/iB5FaDXVyQHGWZ8sh7KYHvbLGkRE/7n7FRt7 DCmhp2nBZh2Yk0LHqOIECRYWPZWTZ4Gg73jkFLandefB13SH5suj+/QZGnN/rbr0jT6I VOhQ== X-Forwarded-Encrypted: i=1; AJvYcCXsDDPFpgTPAtGyBSSd+unUm1UL3QpWRJ1DkdjuJ8jMZUQFoeM8CYWdJcNRoBPeeBJruDJEzFRRmagJEeMznFs/MTwypRLPVh5jysjh X-Gm-Message-State: AOJu0YwL0JfbrXB9DMSagTu6Fjy9WobO2ZGZgLw7K3Gei4CtCxuT2LA9 5lUTuyw2yMg4Bah34gFQXaeOVe5jPd30o5H+PkEWh9tl33rD699rriWNCsK6vFArGRgX/M2Mv5S k+w== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:9e13:0:b0:61a:d420:3b57 with SMTP id m19-20020a819e13000000b0061ad4203b57mr174224ywj.0.1714161430548; Fri, 26 Apr 2024 12:57:10 -0700 (PDT) Date: Fri, 26 Apr 2024 12:57:08 -0700 In-Reply-To: <20240426173515.6pio42iqvjj2aeac@amd.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240421180122.1650812-1-michael.roth@amd.com> <20240421180122.1650812-22-michael.roth@amd.com> <20240426173515.6pio42iqvjj2aeac@amd.com> Message-ID: Subject: Re: [PATCH v14 21/22] crypto: ccp: Add the SNP_{PAUSE,RESUME}_ATTESTATION commands From: Sean Christopherson To: Michael Roth Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, vkuznets@redhat.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, bp@alien8.de, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, jarkko@kernel.org, ashish.kalra@amd.com, nikunj.dadhania@amd.com, pankaj.gupta@amd.com, liam.merwick@oracle.com Content-Type: text/plain; charset="us-ascii" On Fri, Apr 26, 2024, Michael Roth wrote: > On Wed, Apr 24, 2024 at 05:15:40PM -0700, Sean Christopherson wrote: > > On Sun, Apr 21, 2024, Michael Roth wrote: > > > These commands can be used to pause servicing of guest attestation > > > requests. This useful when updating the reported TCB or signing key with > > > commands such as SNP_SET_CONFIG/SNP_COMMIT/SNP_VLEK_LOAD, since they may > > > in turn require updates to userspace-supplied certificates, and if an > > > attestation request happens to be in-flight at the time those updates > > > are occurring there is potential for a guest to receive a certificate > > > blob that is out of sync with the effective signing key for the > > > attestation report. > > > > > > These interfaces also provide some versatility with how similar > > > firmware/certificate update activities can be handled in the future. > > > > Wait, IIUC, this is using the kernel to get two userspace components to not > > stomp over each other. Why is this the kernel's problem to solve? > > It's not that they are stepping on each other, but that kernel and > userspace need to coordinate on updating 2 components whose updates need > to be atomic from a guest perspective. Take an update to VLEK key for > instance: > > 1) management gets a new VLEK endorsement key from KDS along with What is "management"? I assume its some userspace daemon? > associated certificate chain > 2) management uses SNP_VLEK_LOAD to update key > 3) management updates the certs at the path VMM will grab them > from when the EXT_GUEST_REQUEST userspace exit is issued > > If an attestation request comes in after 2), but before 3), then the > guest sees an attestation report signed with the new key, but still > gets the old certificate. > > If you reverse the ordering: > > 1) management gets a new VLEK endorsement key from KDS along with > associated certificate chain > 2) management updates the certs at the path VMM will grab them > from when the EXT_GUEST_REQUEST userspace exit is issued > 3) management uses SNP_VLEK_LOAD to update key > > then an attestation request between 2) and 3) will result in the guest > getting the new cert, but getting an attestation report signed with an old > endorsement key. > > Providing a way to pause guest attestation requests prior to 2), and > resume after 3), provides a straightforward way to make those updates > atomic to the guest. Assuming "management" is a userspace component, I still don't see why this requires kernel involvement. "management" can tell VMMs to pause attestation without having to bounce through the kernel. It doesn't even require a push model, e.g. wrap/redirect the certs with a file that has a "pause" flag and a sequence counter.