From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796323037; b=uYV+c/wk5pMIB0dgKU8mv+TtSkzMYuIdudKfFQ0RjkfR7xaTmlbayoz+jts+2lknBkO2 GQyk+7BilqGC1ThKyEJbHHzyQbEODOl5BNLpEB5IPUAwAWcyZYRIUbJnshQ6lJXJkFwOz Qj8AFvFhTt2PLx+kmPJyUKVsTcBMQFEP2bMOczJUXvoZdcf9Mr4U+ISJa6Bnwm5JRKv0X Cc8eGVX8yBEwKAjUObQ3dgkNaXQZoh0ASkKcUZb1D4kl5+ztC+20qopguzDHuWhPtwtUp MGsupIF70GdjuNkBjA38uZQBzb3ZRjIxSGZdLhDpxd0fh7Fe9Eyac6EXmQqxnkPNB4g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796323037; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ohDDn14YSOKWx5iIvRJD8e6YIfjHV5YO0IDKi5zfiDk=; b=lckXbg0067i0cp2vSAQGmbUUdDW0jkynotrXIa7deI+Emzl2P9uopnXfegWdMKEsgi4J XyakMw0bxI8NI2dfruHU8xo/2izAo3t5GshEQB99N2PhBbgVKWlTVBBxDlU45zRbCaLjV RHuX7fUjFQ17icLh9TkuGAkWrXLjIVhAxaW0tuOMID56ryWCD3zFm/vDG/vcxgXyTihp+ smoqWMT5p2lekUnyVBxkznoJeUk5E8AYvdvAJsByic7OrXRYr/BoycaQ7uhLO+1VMht7A pv+xwYD1tWCnDrh5aFR7+5V9gv7Wl6yRj8CMzJJsNkHHh7bSMed2BMFJ2jMu96cYQ1Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MG5jdpUL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34508606A32D for ; Thu, 3 Dec 2026 18:37:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MG5jdpUL Received: by smtp.kernel.org (Postfix) with ESMTPSA id A12E01F000C1; Thu, 3 Dec 2026 18:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796323036; bh=ohDDn14YSOKWx5iIvRJD8e6YIfjHV5YO0IDKi5zfiDk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=MG5jdpULfHn8fVYf/hGMWXhOnqElJU0ebh0KIh7bXE2NGUqw3x2gVgENR6n8zJwdt 0DBq/JuSoUQMqReDk9kjj6plJMsIx/DFmux1zu6hmOL7oJ4qFGIGk9rsg7Gj7tksfc wDUA9pF41vbX4f0BaEnvP3VWAhoaFJdeRemiKjas1e9Xv7aX05hbg9l3cWMgg+gEsa SWQojYtsIqCAv4mQfqN1u3tc95qqUZU2Z1je42WrXAtC1uWvkHaUxX+GsLKoWxJIHS b3mqrcDRBKrG0IPR50FyMSXSmajVziiZDvhKSqdylVHKPh1/s2ajpTVYGbgpEs2sLU YGgTnHAZlPO8g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] thunderbolt: Always generate the host router UUID Reply-To: sashiko-reviews@lists.linux.dev To: "Mario Limonciello" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261203-thunderbolt-v1-1-347b359ad963@amd.com> References: <20261203-thunderbolt-v1-1-347b359ad963@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 18:37:16 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] thunderbolt: tb_switch_set_uuid() randomizes ICM host router UUIDs - [Medium] thunderbolt: random host UUID breaks ICM NVM auth status cache and PM - [Medium] thunderbolt: random host sw->uuid breaks unique_id ABI and tbnet MACs -- commit a31a94f0079a9a603cbe4c84d45d8948d7a02f23 Author: Mario Limonciello thunderbolt: Always generate the host router UUID This commit changes tb_switch_set_uuid() to generate a random UUID for host routers instead of deriving it from the router UID or link controller registers, while keeping the existing derivation for device routers. > diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c > index 8899fea713ac2..6cedaf5351bd9 100644 > --- a/drivers/thunderbolt/switch.c > +++ b/drivers/thunderbolt/switch.c > @@ -2872,7 +2872,17 @@ static int tb_switch_set_uuid(struct tb_switch *sw) > if (sw->uuid) > return 0; > =20 > - if (tb_switch_is_usb4(sw)) { > + if (!tb_route(sw)) { > + /* > + * USB4 spec requires the Domain UUID to be generated > + * according to ISO/IEC 9834-8 so never derive it from the > + * host router UID. The UID is not guaranteed to be unique > + * either (it can be left unprogrammed) and if two hosts end > + * up with the same UUID the inter-domain link is mistaken > + * for a loop and lanes are never bonded. > + */ > + generate_random_uuid((u8 *)uuid); > + } else if (tb_switch_is_usb4(sw)) { [Severity: High] Does this randomize sw->uuid on ICM host routers where icm->set_uuid is NULL? On Falcon Ridge, Alpine Ridge, Titan Ridge, and Maple Ridge controllers, icm_start() calls tb_switch_add() with sw->uuid unset, so tb_switch_set_uuid() now generates a new UUID on every probe and power cycle. When host NVM authentication fails in nvm_authenticate_host_dma_port(), nvm_set_auth_status() caches the failure under sw->uuid before power cycling. After re-probe with a new UUID, nvm_get_auth_status() in tb_switch_add_dma_port() misses the cache and skips post_nvm_auth(). That permanently leaks the PCIe root port runtime PM reference taken by nhi_pci_start_dma_port(), hides the failure status in nvm_authenticate, and leaks the nvm_auth_status_cache entry. Under ICM, tb_xdp_handle_request() also answers XDomain UUID_REQUEST with tb->root_switch->uuid, which now disagrees with firmware's xd->local_uuid and makes tb_xdp_properties_response() return ERROR_UNKNOWN_DOMAIN. Guarding this branch with !tb_switch_is_icm(sw) avoids affecting ICM. [Severity: Medium] Can generating a fresh random sw->uuid across power cycles break __nvm_get_auth_status() lookups on ICM host routers? __nvm_get_auth_status() keys nvm_auth_status_cache by sw->uuid, so both immediate and deferred host NVM authentication failures lose their cached status after dma_port_power_cycle() re-enumerates the router with a new UUID. This leaves nvm_authenticate_show() reporting 0x0, leaks the cached nvm_auth_status entry, and leaks the PCIe root port runtime PM reference from nhi_pci_start_dma_port(). Storing the software connection manager Domain UUID separately on struct tb would avoid touching ICM host UUIDs. [Severity: Medium] Should the random Domain UUID be kept separate from sw->uuid so host router unique_id and thunderbolt-net MAC addresses stay stable across boots? unique_id_show() exposes sw->uuid directly as /sys/bus/thunderbolt/devices/-0/unique_id, which now changes on every boot and driver reload. That contradicts Documentation/ABI/testing/sysfs-bus-thunderbolt, which documents unique_id as hardware-register or DROM/UID derived and is not updated here. In addition, tb_scan_xdomain() copies tb->root_switch->uuid into xd->local_uuid, and tbnet_generate_mac() hashes it for the thunderbolt-net MAC address. Randomizing sw->uuid causes those MAC addresses to change on every boot, breaking persistent MAC-based network configuration. Because only tb_scan_xdomain() and tb_xdp_handle_request() use the host Domain UUID for inter-domain traffic, storing a dedicated Domain UUID on struct tb would preserve both the documented unique_id ABI and stable thunderbolt-net MACs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-thunderbol= t-v1-1-347b359ad963@amd.com?part=3D1