From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 5AE9623A6 for ; Sat, 27 Apr 2024 00:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176614; cv=none; b=ngwIG+L3ZqckDbdAWVS7gukQSwwRTdjdCcsqHbehU9Jm14iFXf8Qs+VRpiI9/QgyDiSwlg0eCibjSvKEOzMXPKlpuKjqj1bffzAT8Jn+kEZkOYMKMC5VLkQhwuBeD9LAn02Ua3XGxwjRZt1V/p/1PRULoVnakG7oqZGzSxxE3Rg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176614; c=relaxed/simple; bh=yinP9IYiIbLDbM6oDFHQvj2nAf8OvdI9Q9sPTHiIpf0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=nVGbPMpMVqJvaOZ5jmCV/TT1q0Wxc++ZNK3bMT9W50soXRZAxQLEmzGL6uTHbB7D+HWUeqHRv6E8uu1I0n+6+y1EM2ntPcEr/1ZOtNn2S2AQc5nWCOYzHX/O9lLaZanI2QZmhfMxmN3vMNyNjkQA6IycANQBBSifZcy6pNcB2+E= 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=r1QCLdU0; arc=none smtp.client-ip=209.85.214.202 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="r1QCLdU0" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-1eab15b38b9so19636965ad.0 for ; Fri, 26 Apr 2024 17:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714176613; x=1714781413; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pX3e6V8dfSE3Gfut3DvSdpkoJdELEXC0BtcZAcuIozM=; b=r1QCLdU0Mu9VblSfy5+SYA9QBbtfwk+N+t1vt/CeDwp3f7sYKgeX9m4CrhwzGL7HmC ae/NHW5USg9Jvex3XxUeJ4JSQDCZ51Cj/KW/yLcUqr7hPhOGEwoG8D6W5EsCqJiGdAkV 1xT3DlCUv51w+avzJxkgNtK2l3XWJLCDMr7OHc4Paq5Lr0IICnBPnLrXPi2OxD2Ip/3c e5TYWzf7ToNKUMNKjKOA/5i8zU4uWtMNF815WxUpIWD1Go9RJk4Wnv/umPafgLH9kVa8 VBYNK540KVRsAwQB9Duwg0AwyI4oSUSsO2FN6yP3ETl0kPQauTH3FYUB3jjSDJD9tKvo DSQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176613; x=1714781413; 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=pX3e6V8dfSE3Gfut3DvSdpkoJdELEXC0BtcZAcuIozM=; b=NzD/Ay+YvYoyLxS1Zu7uBSzNb60/KtQXRqEooXiYYl6ZBtVkOXiSLTABo4SDykYjU4 LD1DDoG09BEiYl7zAb0jyHHXT/eNm4ddORne7vJO6Th0lQMeG9niIqEnxWd7A3oBXWQ3 fQHe4OExG/Sydw7PLvlhNtDQw0nQC2c3ARISrXENFgMuAvXuWIAoskf6ffSOPSKRELrN LfHuYUAQOGW7iQk8SOFIQqQsheYJynZpxYWYMfDuS1MgeYAjY56JZpGVpGVm2yU/MZfG 6Ky46otrb1gVaDeVTfOAvy5vPOGnwRs4bDDdpO++v1vSGUlPMzGaGXX1e9A1okUQr9Mw H3QQ== X-Forwarded-Encrypted: i=1; AJvYcCXct4t9GxeJFvDDT89DixPg1i34yAWBuRFR2rDVlS4mVGD89fwjvHZeyo3gn7x6wE04qXRPPE/+OMd33gyr1XS6TP/0MLRbnerZ9g== X-Gm-Message-State: AOJu0YxXVkGRoSdcIgF3wviT0A47QY+TI9PbBlAiwZ+zzsH6K71V5WGR PKUDIOMIeLSrb1MKQYcfb8c3YS2pAB+JxtQWWUU/ClDQsCbMxQVmcbcK8S2p0ollwilj+My5lVZ 5uA== X-Google-Smtp-Source: AGHT+IGeE+8TCHmYAm9ZGbpmSgEKJqEs1Jp1O3g0e+nnHHLhKIoKgjH9RHf12yfFHhvL2WEZcXN4ybRfODI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:d4c1:b0:1e5:5c69:fcd7 with SMTP id o1-20020a170902d4c100b001e55c69fcd7mr67795plg.5.1714176612367; Fri, 26 Apr 2024 17:10:12 -0700 (PDT) Date: Fri, 26 Apr 2024 17:10:10 -0700 In-Reply-To: <20240426214633.myecxgh6ci3qshmi@amd.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev 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> <20240426214633.myecxgh6ci3qshmi@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, Larry.Dewey@amd.com Content-Type: text/plain; charset="us-ascii" On Fri, Apr 26, 2024, Michael Roth wrote: > On Fri, Apr 26, 2024 at 12:57:08PM -0700, Sean Christopherson wrote: > > On Fri, Apr 26, 2024, Michael Roth wrote: > > What is "management"? I assume its some userspace daemon? > > It could be a daemon depending on cloud provider, but the main example > we have in mind is something more basic like virtee[1] being used to > interactively perform an update at the command-line. E.g. you point it > at the new VLEK, the new cert, and it will handle updating the certs at > some known location and issuing the SNP_LOAD_VLEK command. With this ^^^^^^^^^^^^^^^^^^^ > interface, it can take the additional step of PAUSE'ing attestations > before performing either update to keep the 2 actions in sync with the > guest view. ... > > 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. > > We could do something like flag the certificate file itself, it does > sounds less painful than the above. But what defines that spec? Whoever defines "some known location". And it doesn't need to be a file wrapper, e.g. put the cert in a directory along with a lock. Actually, IIUC, there doesn't even need to be a separate lock file. I know very little about userspace programming, but common sense and a quick search tells me that file locks are a solved problem. E.g. it took me ~5 minutes of Googling to come up with this, which AFAICT does exactly what you want. touch ~/vlek.cert ( flock -e 200 echo "Locked the cert, sleeping for 10 seconds" sleep 10 echo "Igor, it's alive!!!!!!" ) 200< vlek.cert touch ~/vlek.cert ( flock -s 201 echo "Got me a shared lock, no updates for you!" ) 201< vlek.cert