From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036459; b=l7XJSbHpefCbLTd3UIUUJfTlxl7Mds68BVsfmIuvr/+fbIItJBKFcTlk1wmX1Cm8VcAf 0pVT2d82y2nojVmsMMFkS9vFNa8WbpNQNVSYo5iHmJyEhoyYRxRyGsgWKVIBe7xF+lvit LUNLe3y/l2HIgB5OBuTvjmzxFUf4yGBAdnt3IORY6EmohNAzh09pFjS0owRGyY8s+k7tW hXoCVirfkadl+QpXl2mR/EPfwc3UFRH2sdkBqaxCpZkzN3YqDkgGx+L1JrPMfw5Eo4gVD k45dzpFMBNRyM80ejvqgL3sQgAbSUwcHsjYS6L28ebXOoBcYM5lMd0eBMJLWg83OXqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036459; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=nFdwc1hrNJ327DUKaadwN8aJls0YWkZdQrRC8z9iCZo=; b=dxB1D4dtT0FMwp6YxhKHx4J3aupkyN4ZR6Dt8v0bpBsywGs7Po6SB8aPueIb/+E/kyBq fqvAnLnmIuRhJwJrtx7j6ideOZJBxUzV6UW1SBYshl9Piztltrlb+C+BtC2XMQyVStsOU nG+pFvAlyLDsbcVEbwGbeec5h0sgxVwrmnou8fOl/rZGl4rhRMc0q8ufF0XgN3T+Edzz4 Z4Sxhl90/+hJGUY3/DAZ8ZjV2IApAzVOYoIIW3PPlhCH6uVaUspohzqUiJWEkAuyBrigy 3MJLb32+wQKXuFKxGdxZ+O/xik+7nFv6RdkFPnxvREtQp2LTziq5QUVSD6LA7iyfprA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=R0H1C3gX; arc=none smtp.remote-ip=198.175.65.15 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E932606A33E for ; Mon, 30 Nov 2026 11:00:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0E932606A33E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=R0H1C3gX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796036458; x=1827572458; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nFdwc1hrNJ327DUKaadwN8aJls0YWkZdQrRC8z9iCZo=; b=R0H1C3gXeDBzU/LMPj2HYoTCwuWazCbY2U8gmUu0J0bVo+pmoyUubVtm hpRoYTU2c0uyyiqCczbb/9egVdZ+PwOBPzWspvoZcswwy/nrPlTnzWVpn m0sqBjLgXkHzXwXnfa5+G7IBdxilAM/mkCe/Ndmsi52fNiI07EzrsqrGN Gd0oC9IFbwSvgqO5/3YmHLkTW2+T6Lu4XRPlVeBqVmMcdrVCuFVovkKEz 7BXCHiZHrT+4SIly/f4MfeoIVn8CYJDaJOcDVwgbfXAzK6OzQs+SwIE+a Lbjl873FW7+kJhfaowQ/b6atP48SJivKtSZICHrqJQSt+HFbx+xxZyj3H w==; X-CSE-ConnectionGUID: n6YuXJOAQAyatWZs7QA6xQ== X-CSE-MsgGUID: 14IsGHq7R+WoTROhJOQpwA== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4850577" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4850577" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 03:00:58 -0800 X-CSE-ConnectionGUID: W2y9AgZxS5WoPDRSuTaBug== X-CSE-MsgGUID: nwTZzRIqQCKDtjF+iveuYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="13035894" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.47.46]) by fmviesa005.fm.intel.com with ESMTP; 30 Nov 2026 03:00:52 -0800 Date: Mon, 30 Nov 2026 18:50:14 +0800 From: Xu Yilun To: Xiaoyao Li Cc: "Duan, Zhenzhong" , "x86@kernel.org" , "linux-coco@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "dave.hansen@linux.intel.com" , "tglx@kernel.org" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "Hansen, Dave" , "kas@kernel.org" , "Edgecombe, Rick P" , "jgg@nvidia.com" , "nicolinc@nvidia.com" , "aik@amd.com" , "aneesh.kumar@kernel.org" , "seanjc@google.com" , "pbonzini@redhat.com" , "Gao, Chao" , "Verma, Vishal L" , "Tian, Kevin" , "Peng, Chao P" Subject: Re: [RFC PATCH 00/15] PCI/TSM: coco/tdx-guest: Implement TDX-Connect PCIe TDISP (phase2) Message-ID: References: <20260924041032.1096569-1-zhenzhong.duan@intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Nov 26, 2026 at 04:15:03PM +0800, Xiaoyao Li wrote: > On 11/26/2026 11:11 AM, Duan, Zhenzhong wrote: > >> 3. TDG.TDI.MMIO.ACCEPT requires TDI to be in the ASSIGNED/ACCEPTED/RUN > >> state. > >> After TDI is bound by host via TDH.TDI.BIND, the state is BOUND. It > >> requires > >> guest to call TDG.TDI.RD read the TDI_GET_BIND_SESSION_ID, which changes > >> TDI > >> from BOUND state to ASSIGNED. > >> > >> This is a hard dependency for TDG.TDI.MMIO.ACCEPT not to fail and it's > >> not > >> mentioned in patch 12 where the call to read TDI_GET_BIND_SESSION_ID is > >> added. > >> > >> The SESSION_ID is used to ensure the host doesn't bind a new TDI after > >> guest attests the TDI without guest's awareness because the SESSION_ID > >> is > >> verified in the following TDG.TDI.START. And making the read of > >> TDI_GET_BIND_SESSION_ID to change the state machine of TDI from BOUND to > >> ASSIGNED, make it mandatory for the implementation. > >> > >> But it doesn't make sense to assign additional semantic to a metadata > >> reading > >> behavior in a specific phase. Instead, we want to propose introducing a > >> new > >> dedicated TDG call, e.g., TDG.TDI.LOCK, which needs to be called by the > >> guest > >> to lock the TDI after it's bound by the host, and it returns > >> TDI_GET_BIND_SESSION_ID on success. > > What TDG.TDI.LOCK locks? > > Or is it essentially a renaming of TDG.TDI.RD(TDI_GET_BIND_SESSION_ID) > > to make the state transition(BOUND -> ASSIGNED) explicit? > > It's not a rename of TDG.TDI.RD(TDI_GET_BIND_SESSION_ID), but a replacement of > the semantic of transitioning the TDI from BOUND to ASSIGNED. I have concern that we need to explicitly expose TDX module internal state to the guest, though without the proposal the internal state can still impact the guest if it doesn't do attestation as expected: The evidence hash verification fails if TDG.TDI.RD(TDI_GET_BIND_SESSION_ID) is not executed. To the guest, the correct way is to get the bind session id (like an epoch) first, then retrieve evidences. Otherwise, the guest can't tell if the host unbinds & rebinds the TDI during/after attestation and finally accepts a different TDI from what is attested. So the internal state doesn't impact the happy path and the guest can pretent it doesn't exists. But now we want explicit the BOUND to ASSIGNED state, I have to wonder if the ASSIGNED state is really necessary. The TDX module uses it to ensure that the evidence matches the bind session, but I don't see it fully reaches the goal. It prevents rebind before attestation, but it can't prevent rebind during/after attestation. And it doesn't have to, the final TDH.TDI.START catches all the rebind attempt. So could we just drop the ASSIGNED state, a sane guest knows what to do to prevent attack. It can also choose to be lazy to do no attestation and just accept, the TDX module can't prevent that. > > TDG.TDI.RD(TDI_GET_BIND_SESSION_ID) is still supported, and can be called > anytime. When TDI has valid BIND_SESSION_ID, it returns the session ID. > Otherewise return error. > > > Clarifying this will help determine whether "LOCK" or something like > > "ACCEPT_BIND" / "ASSIGN" better reflects the underlying operation. > > Yeah. It looks "LOCK" doesn't sound good. Because guest cannot lock anything, > and the host can still unbind the current TDI and bind a new one. > > TDG.TDI.ACCEPT_BIND or just TDG.TDI.ACCEPT?