From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 C57782F7AA0 for ; Sat, 25 Oct 2025 11:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761393368; cv=none; b=NFDaeEF3rlalP8BjHHFbWxwT1ArUe5+5slLgmA2VCa8k9A5RYcEPJWiQ0gNfoQMT0TrkXeszZIKzVONN6fM7tR1djeJ9Dp5Ca3zUigyr2/gQ9w2T5eFt0+HKR9KNiswpobY4GSRRW40DxolT4z7G7h9/gvtDc/N4TYN3T6sMT9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761393368; c=relaxed/simple; bh=IbVzirtx13zj8iro8c30f/cJH4Z9WeL1XylLbXVZg0Q=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OAscA9MLKpu/NmiI1B/u09k1rDW30NFHOCMX3HNaWkDRP00qXubguObeWclEZUhU4/hIpcuqRIP8XtO0WC5dZxaMSmqiR3FJxYUgORAy8abIDZh89dO75CzRXUZPkT9qCAeTsB7wfNaXfxHx/yCheHur2H3jNlCdkoqND3M3Zrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=fgjhfuTA; arc=none smtp.client-ip=209.85.214.181 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fgjhfuTA" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-27d67abd215so122735ad.0 for ; Sat, 25 Oct 2025 04:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761393361; x=1761998161; darn=lists.linux.dev; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6Ct7/efD1GEoaA/ffsrEA43iPZ+ATBVXvTsFiAb3WeU=; b=fgjhfuTAA59LocknbxZc3AbkeWS9AHSRWKgsaaH9FK35JFNXEJODqzPX79IxsINFaC RnJoP6QSGxX5nJNQukNiyD+fKMERZpZajX9MRPsW9lqtAO/hEvBzpFs9JyQ+EALoAqPi gjbwq68LqnYQG9BWDkpABmqrQOhLEdu3aUnTCfNFt0DoM9nYQZ3nmMnKJS2guJxuhcxE T9yck8/4SVco8e7ZlPaKR6SKvINzNWbbickFkQIqNeQrZTD47izRh7vJyEJPf9pNdQzn cbpSDSXf4T2X0o+gPjA5W3/prx6eaitltYfxTBDNAnp6SrBTL5x3RvlFqpvKd0Q6An3q VTgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761393361; x=1761998161; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Ct7/efD1GEoaA/ffsrEA43iPZ+ATBVXvTsFiAb3WeU=; b=jgh/x4R4isZhZfX/OF/L6bq1Ak6u54WsV9cxbqpD3jpGk00JSZCG/bPJo0vjnsGmv3 uar0HpOf/g5gnWLmjQxbln+eSrSp7bVJxpIw+lZMJlUd79CP0ngFZZvDTxPjfs61Eesp LqxVgXhvwVQ0tHE1qRCtlKhRFaoLxS1klMQb9VxbXRV5R3/76hvbQRUIDTZnIZj8BXkZ 9WPyg9S/+JV3CEUhWdk+9Rx3QxlQSF9Krjysl+POJvzPWxx7e95YQ0+tesq9blT/5uHE BreB0WUdGei+Vn9/DF2KR8ycLRaL/uINQoD2D/cyrNUm1/rJ9w7mTckj+fCpGxEyyijn YcLw== X-Forwarded-Encrypted: i=1; AJvYcCU25R73d/1E00INC6TU4lpt92av6M0xFi1YtnHjCcH7gAsDxWbNtnFY/H3RgZIkvEO8zBxBpB1yMnOX@lists.linux.dev X-Gm-Message-State: AOJu0YzZB9gewZGViOC9pIDZ7nq6U4fiQZntRKkYuPtoySQrCOML/teY 3kkv8uSI2tZ4/bOaGEnJ+IvpP+60NEBuM8uE6CdioktDw6xSaAtBq5eq7jL4sM2Z4QJvwgAmSa9 ZTVSENuY/fae1HUaSqW2nBSuljD3Y0U2EbrTZcvNx X-Gm-Gg: ASbGncsvbbUaH6DnJRijmc91fGGnrISCidIMHn394HBZdibtmvtvklb8O8JYpsWkrwL UteO9w+vnvbX5lnQPy4Y+WCTLNjNR9yPEmmIFIhyOF0o1xlZNMPgC7rJYuvi7hoBl9+IlP99Qmn JJ9apO9SkqIthLwbq8R3nGNZOcnTZahcUaUgiIbxP9ExBGDWf+ePAn5nLcutU9u4yBkIHRBNsSx 6e3cEBEwLzcRa7WTdWKhU6dhTXrVkN5/I/Wi6cRlZ786fyv9rOcfcPxBPJ/s41SckL2//AVKpYk rD3v1uuSBQxgeuQDB7L02p+N/c0= X-Google-Smtp-Source: AGHT+IG/erEWja2xd4C3neXolA/4VGgAb4uoVKQMLlsBEtBRAWc7KQtZNePwJxR05qqxPoQqZGVWq8vd/ZcII6ZuX5E= X-Received: by 2002:a17:902:c406:b0:25b:ce96:7109 with SMTP id d9443c01a7336-29497cb6798mr2714785ad.3.1761393360539; Sat, 25 Oct 2025 04:56:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <5b4c2bb3-cfde-4559-a59d-0ff9f2a250b4@intel.com> <68fbd63450c7c_10e910021@dwillia2-mobl4.notmuch> <2e49e80f-fab0-4248-8dae-76543e3c6ae3@intel.com> <68fbebc54e776_10e9100fd@dwillia2-mobl4.notmuch> <10786082-94e0-454e-a581-7778b3a22e26@intel.com> <68fc2af6305be_10e210029@dwillia2-mobl4.notmuch> In-Reply-To: <68fc2af6305be_10e210029@dwillia2-mobl4.notmuch> From: Vishal Annapurve Date: Sat, 25 Oct 2025 04:55:46 -0700 X-Gm-Features: AS18NWCgHlzsnNJ7NBPcSXANACdF5lgDhlf80wCXpQLkk7p_f_jLit3U4dFWFqM Message-ID: Subject: Re: [PATCH v2 00/21] Runtime TDX Module update support To: dan.j.williams@intel.com Cc: Dave Hansen , Chao Gao , "Reshetova, Elena" , "linux-coco@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "Chatre, Reinette" , "Weiny, Ira" , "Huang, Kai" , "yilun.xu@linux.intel.com" , "sagis@google.com" , "paulmck@kernel.org" , "nik.borisov@suse.com" , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , "Kirill A. Shutemov" , Paolo Bonzini , "Edgecombe, Rick P" , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 24, 2025 at 6:42=E2=80=AFPM wrote: > > Vishal Annapurve wrote: > > On Fri, Oct 24, 2025 at 2:19=E2=80=AFPM Dave Hansen wrote: > > > > > > On 10/24/25 14:12, dan.j.williams@intel.com wrote: > > > >> The SGX solution, btw, was to at least ensure forward progress (CP= USVN > > > >> update) when the last enclave goes away. So new enclaves aren't > > > >> *prevented* from starting but the window when the first one starts > > > >> (enclave count going from 0->1) is leveraged to do the update. > > > > The status quo does ensure forward progress. The TD does get built = and > > > > the update does complete, just the small matter of TD attestation > > > > failures, right? > > > > I would think that it's not a "small" problem if confidential > > workloads on the hosts are not able to pass attestation. > > "Small" as in "not the kernel's problem". Userspace asked for the > update, update is documented to clobber build sometimes, userspace ran > an update anyway. Userspace asked for the clobber. > > It would be lovely if this clobbering does not happen at all and the > update mechanism did not come with this misfeature. Otherwise, the kernel > has no interface to solve that problem. The best it can do is document > that this new update facility has this side effect. In this case, host kernel has a way to ensure that userspace can't trigger such clobbering at all. That IIUC is "Avoid updates during update sensitive times". Best kernel can do is prevent userspace from screwing up the state of TDs. > > Userspace always has the choice to not update, coordinate update with > build, or do nothing and let tenants try to launch again. Userspace > could even retry the build and hide the tenant failure if it knew about > the clobber, IIUC host userspace has no way to know if the TD state got clobbered. > but be clear that the problem is the clobber not the kernel > doing what userspace asked. > > The clobber, as I understand, is also limited to cases where the update > includes crypto library changes. I am not sure how often that happens in > practice. Suffice to say, the fact that the clobber is conditioned on > the contents of the update also puts it further away from being a kernel The knowledge of things getting clobbered are well much further away from userspace. > problem. The clobber does not corrupt kernel state. > > > > Oh, yeah, for sure. > > > > > > If we do _nothing_ in the kernel (no build vs. module update > > > synchronization), then the downside is being exposed to attestation > > > failures if userspace either also does nothing or has bugs. > > > > > > That's actually, by far, my preferred solution to this whole mess: > > > Userspace plays stupid games, userspace wins stupid prizes. > > > > > > > IIUC, enforcing "Avoid updates during update sensitive times" is not > > that complex and will ensure to avoid any issues with user space > > logic. > > Userspace logic avoids issues by honoring the documentation that these > ABIs sequences need synchronization. Otherwise, kernel blocking update > during build just trades one error for another. Kernel blocking update during build makes the production systems much safer and prevents userspace from screwing up the state that it has no way to detect after the fact. > > Treat this like any other userspace solution for requiring "atomic" > semantics when the kernel mechanisms are not themselves designed to be > atomic, wrap it in userspace synchronization. In general if this is something userspace detectable I would agree, TDX module is the closest entity that can detect the problematic sequence and the host kernel has a very simple way to ensure that such a problematic sequence is not at all allowed to happen by toggling some seamcall controls. It would be very helpful IMO to ensure that userspace is not able to screw up production workloads especially if the mess is not all visible to userspace.