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=1796217151; b=kiIztvkCAIpi2/ZIRlYKclBiVI0HVLp/jIB0Duiz4ED5G1rZS3KI7bnCU5qSBk3daHkX WrKHaVqZ+UAC2xyySLnhPH+VSJhXZWKuVYhrq2dVxUDHFN6xnjiDGtw6PsHFrkvi5tPY1 klIZlhleaCQTnbogiuFtXRfCsj7jorwuWJQns3jRVzUy3Ln5aGNrAz6sk8UejddKfZNA4 yTUv7Qx10MKR1iupb/wLdYVcc87zEFd3VMZxEYZLeuiOBQH8nGviyQNbVDj8GPM59jIFO yGBqjsjcUD6zOLoIDImSGp4ddHf30FpwjDA8lCWrC+J9TuC/pNDPQNg+cEhNXe5MU0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796217151; 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=cM43TUjLgHvFUZ4Y1b07pQ0kbmXf17FVZu4yPdjTW5o=; b=2ZyxnL6RROqXbEwCOVew2sjqGGCNPQSVAAZF6PfaPChiRD4lLehlBZaqF5wGaWG+Yxik Q5iI8lgR9moNYOf4Q1Ht9dXqxZtGGjwkwQMPBS1KUN2BFqxcx+V/jMauyWCeyStORNF08 c+/rAa1dNiHoFcMuvkW2+MQAiOPrlvrGTXr3Q5NNEsUtka8gMQ78rJdn59XufZKbwQya8 in3g7f22qaRPETwHJDvlAFncSEeIqsUYyvvhlKOrsNkhFFfDngl3Mp0wz/oIct8TM48c/ 3hM7el2KROea+lFHb6GSp2WQ9jMi72YGAyGUbtmYU9yBncrbVBALuD21e6oZcH4h6fA== 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=VDQW50AB; 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 5198C606A327 for ; Wed, 2 Dec 2026 13:12:31 +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=VDQW50AB Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5CC71F000C1; Wed, 2 Dec 2026 13:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796217151; bh=cM43TUjLgHvFUZ4Y1b07pQ0kbmXf17FVZu4yPdjTW5o=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VDQW50ABeJyKl5SSbTH1Wcom/yVypaOdKQnuXCoVd6qwnuDrbNLE+Y88IKydIGEmB vgARRxLPTQGgw8De5VUVkItqXZwirseuMbV/XsDMgEjYwHzi8Crh+gle3HjtcSor2P I5nwMiHCFrmECxOW0oZ2QrSccAfHTA62hISAapV3d1sJUTmIeazVGicqjKegYhGs+4 Vs1tCnwLTl9ubWm63d3e8/HG22HBxKy20EYdliCEVl+93boU+sGCVHbLV+JIiUnUAr PtLGWxphQn4OoR3eu1ZmaxCJv/NKvHG1bGYDoej86muqwYlsSOCoBxmlN/saR8lNWK Ow6G5UkLRaguw== Subject: Re: [PATCH 15/22] net: xfrm: interface: restore dst_orig on every xfrm interface 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:30 +0000 Message-ID: <179621715052.3146.1140038363639422089@kernel.org> In-Reply-To: <20261201124252.1163254-16-steffen.klassert@secunet.com> References: <20261201124252.1163254-16-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 commit message leaves out the most serious production impact of the per-cpu design that this patch removes. - [Low] The patch carries 'Cc: stable@vger.kernel.org' and 'Fixes: 94151f5aa966' (Dec 2022, v6.2 cycle), but it depends on helpers that… -- net: xfrm: interface: restore dst_orig on every xfrm interface This patch makes xfrmi_xmit2() restore md_info->dst_orig for both collect_md interfaces and interfaces with a configured if_id. It takes its own reference with dst_clone() and drops the metadata dst from the skb before installing the route. It also changes bpf_skb_set_xfrm_info() to allocate a metadata dst per skb instead of using the shared per-cpu xfrm_bpf_md_dst, which is removed. Link: https://lore.kernel.org/netdev/DMZJS8O5A4YX.9T2P4DT0DAB7@gmail.com/ > The same slot overwrite is in the unstable helper a tc-bpf program uses to > attach that metadata: bpf_skb_set_xfrm_info() records the route as dst_orig > and installs a per-cpu metadata dst over it. The per-cpu dst is shared by > every invocation of the program, so the restore cannot keep anything in it. [Severity: Low] This isn't a bug in the code. But does this paragraph understate what the per-cpu design did on production kernels built without CONFIG_DEBUG_NET? In the old bpf_skb_set_xfrm_info(), the skb's counted reference on its route was moved into the shared per-cpu metadata dst and never dropped: skb_dst_force(skb); info->dst_orig = skb_dst(skb); dst_hold((struct dst_entry *)md_dst); skb_dst_set(skb, (struct dst_entry *)md_dst); Only one path gave that reference back: the collect_md arm of xfrmi_xmit2(), which cleared md_info->dst_orig and kept the route on the skb. Any other packet left its route reference in this_cpu_ptr(xfrm_bpf_md_dst). That covers a packet dropped after the helper, a packet redirected to a non-xfrm device, and a packet sent through an xfrm interface with a configured if_id. The next call to the helper on that CPU overwrote info->dst_orig. The per-cpu object is never freed, so metadata_dst_free() never got to run this: if (md_dst->type == METADATA_XFRM) dst_release(md_dst->u.xfrm_info.dst_orig); So it looks like one dst reference leaked for every such packet. Also, if_id, link and dst_orig lived in a per-cpu object rather than in each packet. A packet held in a qdisc between the helper and xfrmi_xmit2() could then pick up another packet's if_id and route, or find dst_orig already cleared. Is that right? The fix description only says the route "belongs to that skb and is released with it". Could the message also name the dst reference leak and the mixing of metadata between packets, next to the DEBUG_NET warning and the dropped packet? > diff --git a/net/xfrm/xfrm_interface_bpf.c b/net/xfrm/xfrm_interface_bpf.c > index 5ea15037ebd10..7afbdbd111454 100644 > --- a/net/xfrm/xfrm_interface_bpf.c > +++ b/net/xfrm/xfrm_interface_bpf.c [ ... ] > @@ -86,7 +79,11 @@ __bpf_kfunc int bpf_skb_set_xfrm_info(struct __sk_buff *skb_ctx, const struct bp > skb_dst_force(skb); > info->dst_orig = skb_dst(skb); > > - dst_hold((struct dst_entry *)md_dst); > + /* The metadata dst releases dst_orig when it is freed, so the > + * reference the skb held is stolen rather than dropped. The dst > + * allocated above is handed to the skb with its single reference. > + */ > + skb_dstref_steal(skb); [Severity: Low] The patch carries Cc: stable and Fixes: 94151f5aa966, which dates from the v6.2 cycle. skb_dstref_steal() was only added in August 2025, by commit c3f0c02997c7f8. Will this build on stable branches that contain the Fixes target but not that commit, such as 6.6.y or 6.12.y? The reproducer in the commit message also looks specific to newer kernels: so the first packet that calls it panics inside bpf_skb_set_xfrm_info() on a CONFIG_DEBUG_NET=y build with panic_on_warn=1. That warning is the DEBUG_NET_WARN_ON_ONCE() in skb_dst_check_unset(), which skb_dst_set() calls. It was added by commit a890348adcc993, also in August 2025. On older stable kernels skb_dst_set() overwrites the slot without warning, so the stated reproducer would not trigger there. Should the commit message name these dependencies, or point to an adapted backport for older trees, for example one that clears skb->_skb_refdst directly? > skb_dst_set(skb, (struct dst_entry *)md_dst); > return 0; > } -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201124252.1163254-2-steffen.klassert%40secunet.com