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=1796217152; b=xAFjrKGWFiiW03mXT1SSPFTQrB2aKaBkBXQrj8aMN480+8aLjk74/jwQ6nM/0JvjFjRT 8RclM8YgSBTL1yyNzG0RQzynMeIJUBNgu5PiMn8lszpuhtqXDj9hnd5DyVMCm5QQw7z2+ Udx8F45516H4Y+NJJmA46ViBhP3cUsI6up2uiWV6Bg4i+C0Q0iwuehPIfjzf8/GoKBM79 K2uW8/u6PhjbdeWpoJHhjAxhg1Bi+ybpmdJPmuYguLUgYjEiL4Puct+FNVeJgTtmZGMzK jAOSayVt2SRH4xWhBRiqtTiIdUTvu4B0odKDMwYqSVgK/P3w4Fzfe58pyWRgubMdpKA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796217152; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=S+pNwhZiHRnigxWHceEKRHFiAXj98yowtQ66Dc9vnL0=; b=lkb6VUMEt2pcDOqLHllCSM0upcu0Wnpt0/IhtaA8zGN0VgMPxTb9qdpxsj0Ta8mIylu3 FWOk1C/mJOBrHTYqAYJNLX0Cm0P0307iqZVBcwRHXQnsOElkrGEnadAzgllOTgeSoNxd7 EDB3w8FtYHC33pnUcgvyOoO8LKP6nqtRafFNsDLU6dspvcRQznIOFFJRVuW0nACu7w0t7 Mwy2+BFBwxK/sLPaLduKID32GnraP/EkuGEPjZl9vIkAOlEPPedN4kSjRsgDtw5rnjZvD Dq5rLF9YI9DeSRvZ+0CooM9RLpDARCmmYaxZDO7x9AT5YDXUfDpKlnmc8EvrskYvLkQ== 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=gPqY9O4a; 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 8BDFF606A31A for ; Wed, 2 Dec 2026 13:12:32 +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=gPqY9O4a Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFE4B1F0089B; Wed, 2 Dec 2026 13:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796217152; bh=S+pNwhZiHRnigxWHceEKRHFiAXj98yowtQ66Dc9vnL0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=gPqY9O4afqSq6NgyfgPrz9dMtfFZPhpV/M/rIpS0rRng8PaIct7NZgA2y4oB1uBc1 h2pGnoe+cOrm11ypLq8IqjvSZ6kd/qace9wL6bnW9Kw0aegsmVDppNSgjZzj1Zq1r+ E3BSh6dMBYwJiprA1macZAzyRIEbXOxWMaagtN7AGcK18uc2l0bDceZqA599LiavWE TdMhxxL2i73GD3lZCIgyuogznFVywTTDmdczdln480dBhfZ0eHN0pkTmv8msoFdVn2 w9CfRJpLHQQBL0vw/FyL5ocTKstYzVYAR6dptvJTLdKchJpPu0Xr6kZiEBDgwj9myH uJp0tzoh6Tulw== Subject: Re: [PATCH 18/22] xfrm: Give GC list nodes their own storage From: netdev-bot+sashiko@kernel.org To: steffen.klassert@secunet.com Cc: davem@davemloft.net, kuba@kernel.org, herbert@gondor.apana.org.au, netdev@vger.kernel.org Date: Wed, 02 Dec 2026 13:12:31 +0000 Message-ID: <179621715135.3146.4147128045971415279@kernel.org> In-Reply-To: <20261201124252.1163254-19-steffen.klassert@secunet.com> References: <20261201124252.1163254-19-steffen.klassert@secunet.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The Fixes: tag is incomplete, and the description of the bysrc half is imprecise. -- xfrm: Give GC list nodes their own storage This patch takes gclist out of its union with bydst. It also moves dev_gclist out of its union with bysrc and into a union with byseq. This keeps the bydst and bysrc hash linkage intact for RCU readers that are still walking a state after it has been unlinked. The code change appears to fix both overlays. The questions below are only about the commit message. > The same issue applies to dev_gclist and bysrc. [Severity: Low] Is the bysrc case really the same issue as the gclist case? The gclist overwrite only happens when the last reference is dropped in __xfrm_state_destroy(). xfrm_state_gc_task() then runs synchronize_rcu() before freeing. For offloaded states, dev_gclist is written right after bysrc is unlinked. It does not wait for the last reference: __xfrm_state_delete() hlist_del_init_rcu(&x->bysrc); ... spin_unlock(&net->xfrm.xfrm_state_lock); xfrm_dev_state_delete(x) hlist_add_head(&x->dev_gclist, &xfrm_state_dev_gc_list); That overwrites bysrc.next while a reader in __xfrm_state_lookup_byaddr() may still be sitting on x: hlist_for_each_entry_rcu(x, state_ptrs->bysrc + h, bysrc) { After that, xfrm_dev_state_flush() can call xfrm_dev_state_free(). That function does hlist_del(&x->dev_gclist), which sets next to LIST_POISON1 without a grace period. A concurrent bysrc reader could then dereference the poison pointer. Could the commit message describe the bysrc case separately? > Fixes: d737a5805581 ("xfrm: state: don't use lock anymore unless acquire operation is needed") Does this tag cover the bysrc half of the fix? d737a5805581 only made xfrm_state_find() walk bydst under rcu_read_lock(), so it matches the gclist/bydst overlay. The dev_gclist/bysrc union came from 07b87f9eea0c ("xfrm: Fix unregister netdevice hang on hardware offload."). When that commit landed, every bysrc reader held xfrm_state_lock, so the overlay was safe. The overlay became unsafe with 2e460eefbd4469 ("xfrm: state: make xfrm_state_lookup_byaddr lockless"). That commit replaced spin_lock_bh(&net->xfrm.xfrm_state_lock) with rcu_read_lock() in xfrm_state_lookup_byaddr(). This turned __xfrm_state_lookup_byaddr() into a lockless reader of bysrc while dev_gclist still shared its storage. Should the patch also carry the following tag, possibly together with 07b87f9eea0c? Fixes: 2e460eefbd4469 ("xfrm: state: make xfrm_state_lookup_byaddr lockless") Backporting to trees without 07b87f9eea0c will hit a conflict in the xfrm.h hunk. The current message doesn't say that only the gclist/bydst split applies to those trees. -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201124252.1163254-2-steffen.klassert%40secunet.com