🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25298

Re: [PATCH 13/22] xfrm: iptfs: force a dst reference before queueing an skb

#25298
From: bot+bpf-ci
Date: Tue, 01 Dec 2026 13:36
57 lines
9736 bytes
--===============2487831420131990835==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

> xfrm: iptfs: force a dst reference before queueing an skb

TL;DR: Commit message only: the claim that iptfs_output_collect() always runs
under the caller's RCU read lock may be inaccurate, since the udp_sendmsg()
path has no RCU lock. The code change itself looks fine.

> iptfs_output_collect() is the dst->output hook and runs under the
> caller's RCU read lock. It queues the skb and sends it later from the
> iptfs hrtimer. The skb may still carry a noref dst, e.g. one set by
> __ip_queue_xmit() via skb_dst_set_noref(). Once the RCU section ends,
> nothing keeps that dst alive.

This isn't a bug, but is "runs under the caller's RCU read lock" accurate for
every caller?

The udp_sendmsg() -> udp_send_skb() -> ip_send_skb() -> ip_local_out() ->
dst_output() path reaches iptfs_output_collect() in process context without
rcu_read_lock(), although the dst there is already refcounted so
skb_dst_force() does nothing.

Would it be more precise to say that callers that attach a noref dst hold an
RCU read lock?

> diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
> --- a/net/xfrm/xfrm_iptfs.c
> +++ b/net/xfrm/xfrm_iptfs.c

[ ... ]

> @@ -1914,6 +1914,13 @@ static int iptfs_output_collect(struct net *net, struct sock *sk, struct sk_buff
>  			continue;
>  		}
>  
> +		/* The queued skb outlives our RCU section, so pin its dst. */
> +		if (!skb_dst_force(skb)) {
> +			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
> +			kfree_skb(skb);
> +			continue;
> +		}
> +
>  		/* Enqueue to send in tunnel */
>  		ok = iptfs_enqueue(xtfs, skb);
>  		if (!ok)


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/46652847109
--===============2487831420131990835==--
Technical Details
Message-ID: <ad0cfc226ab54d097222963f0b8f1eb33a08b0406bd88dec1e763d137801cc5b@mail.kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375114-linux-kernel-netdev=dewy.ru
References: <20261201124252.1163254-14-steffen.klassert@secunet.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375114-linux-kernel-netdev=dewy.ru
From: bot+bpf-ci@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 13/22] xfrm: iptfs: force a dst reference before queueing an skb
Date: Tue,  1 Dec 2026 13:36:17 +0000 (UTC)
Organization: Usenet Network
Message-ID: <ad0cfc226ab54d097222963f0b8f1eb33a08b0406bd88dec1e763d137801cc5b@mail.kernel.org>
References: <20261201124252.1163254-14-steffen.klassert@secunet.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============2487831420131990835=="
Injection-Info: usenet.network;
	logging-data="1723660"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QCKvqqHx7ZbBiag+5ODCj7ANmP0= sha256:zfVOgVz1Hju0UHXt/3I0gkm0wXQzig97jFsC1zsQ8fQ=
	sha1:TC01qvhvT5yxUEOPlU7d4AlJsBI= sha256:puc+rQfT54rZR7wGi454tQrCkle6Ym3RMUs4t0pDnbQ=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 1E5FD1173BE; Tue,  1 Dec 2026 16:37:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id I6x4T7XFmyiG;
	Tue,  1 Dec 2026 16:37:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375114-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 612721173BA; Tue,  1 Dec 2026 16:36:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 5169B31C90; Tue,  1 Dec 2026 13:36:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796132180;
	b=CfwmxtJ036CpEoIKxxlWGvbEUfQ/9LRQNcHLExuVVD3ZZ4Yk9XWcPkyqKC3svK2FhfLq
	 XNUEoAeSReLW6ptTn+RU9XPG6rYoJXuG5aVS9csA3QOZQAJG6RPjHtMHAeMenTv6kX9Ms
	 gtT23Na2Y91u3tuePdoh7vfDBuk0eyGIUn94fU3k2hejMDEYBqEVNzNYt5SwkFFMKpVna
	 WOrSp4ude1IplDhK8/OZtOpTrF5fwZIFRkqfmW4u9P4glOE6TpM/jqzPdK7Uud4LN6ddm
	 VampRC3SKgAKf/7wXH7vayrSnwtdrurVit/ok9DTOmyw54z2qRWvUWug2hCvfKZiU2g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796132180;
	h=X-Original-To:Received:Received:DKIM-Signature:Content-Type:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=suzDa/JbpE+uWfy1E0gS+drSz3rS4qWqe178WtS0PsU=;
	b=lUGTStyrPu8K+Dvj2ulovpr1YfALO215ZhvY8VCX3bS0VVfCINU6jtrF/CbpYCZngpdZ
	 azwesXqm+DIv35fHuuk/7p/DbEBZlRBTncMHblTO8TvcooMQ09CMA10ChiPdiAwnQ9raC
	 0qXQ0hCgxE17dOwsc76hbFeUxqO+05tW2bvybi1/eAMSs9TxqWGDtw+12vsbBl+xaD4gP
	 psO2/QyKFnSzDWQ0YlLPBGfDtVlaj3bj8h0YmwerPUpDlEtKSoEVCgxpW5hdGn1COeWQa
	 bcUTcpCMGFThzMZhND14/0RjQdIh/RARZuhUWW9mZnPfhvyQ1agGVZcBw9x35R9/5cw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Km/2lk6B";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 52544606A32E;
	Tue,  1 Dec 2026 13:36:20 +0000 (UTC)
X-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=Km/2lk6B
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796132179;
	b=G6zIQB4x7SnC3SG4A0kodl+efEWF0E8XXRh8qQAZ8ueOVUo/AmTMIwnwDBfCRa88gsw/
	 n1jRILwyEGix3Cv/6PaZoxzllhyS9l6X0XcfqvRg3WH4AHfuOFj3c6tXdk7bJ0R6UKI1T
	 DhfhzU65BFObma4n0xAsB4j5HWpFZAJjWVxZpU57iahpkHz4thqvR80IdSCAvDYY9Q9Y9
	 GK/7/dqj1UKd1/gq7g43HD+CyGhNN5mySTdz+74y0gBU/w0vrdV6coDBOm/7voinP7ce6
	 EiMigpkxvXyqaOGbs0+GT47ox9Ga05m5RYiH/uTK2cHeB2UCpdtW1xto24K8xs8t5kQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796132179;
	h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=suzDa/JbpE+uWfy1E0gS+drSz3rS4qWqe178WtS0PsU=;
	b=eL1c8sfM4dc4nRdA86i4YvlqHjRgug9Q883qM2OobA9+l1QCZbI1WgzO7UlAET9RNCJd
	 YLm2IeTAUIO6Yot+Df5X/THqStBtVxn3kWjNRuEwC0CrryLb8xIYLGdxvZ94ic9jDKCor
	 3XMWp6wGUKm0fKkAdUEWXIiirSfbZ3GPAqZ+vauOkotWHw3KvREPaygHApPRQzqiGFFFi
	 enioS+8SaVH3m6oJcppN8ikkYneN67P81my3CNiUY//A30PNSy+IaJ9+l8O/LluZ8rzlx
	 r4+8OVhuJBcloCCOWfIaKkkruGC81UnBtrmAEo918uBApiz+VGyDcsy9JRqTbe+gPQQ==
X-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="Km/2lk6B";
	arc=none smtp.remote-ip=100.103.45.18
X-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 74A73606A327
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 13:36:19 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC46C1F0089B;
	Tue,  1 Dec 2026 13:36:17 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796132179;
	bh=suzDa/JbpE+uWfy1E0gS+drSz3rS4qWqe178WtS0PsU=;
	h=In-Reply-To:References:Subject:From:To:Cc:Date;
	b=Km/2lk6BvY94yjDC16Kvh5Mekxcdar+Z65y+mazEZr61ihdDG9GU2Ij9qommNYYiU
	 l6WTwE+W8ae3mX3oxGGZvYg1Y9QLk9zRQeJ51nzvVWz78H/ph3eP1oxcrZkrJrodmr
	 Kbj38KTRXWRsFAFvggw7AH89Wju+p1DyyHOI2GXKsUjVkdv6dKIo0AI/RzuTmLpQUJ
	 nPvg/fA7ZwwkktVlz2J2HrIcp7RhwfLJNCDLrpVePsi4EpvYVv7N/iMQgyOupq2nUL
	 OAIedG8ZOlsO10DW95t85EgY3rGtbwUcGhWULNH/wsSYQ122eCCqESukcy/LdaIrbt
	 1qmlip6eJEGkw==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261201124252.1163254-14-steffen.klassert@secunet.com>
X-Cc: herbert@gondor.apana.org.au,steffen.klassert@secunet.com,netdev@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev