From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6582F258EC8 for ; Tue, 14 Oct 2025 06:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760423849; cv=none; b=Zw+ZKWl51pSGtk3k5PZh1fcAb90lzodnFQiYeX6KJypck1bbZk08BQ3dyF+PTGqd8GkcXUhUsvMcn5PtdvjD+T+OSz1r4ZSY00fEm4Hgne+bPLvf9tU+pv9tJDwj4bi8rMOP8fX2BVRlKhswPeX5dCP5MFshfbCqRokhDcRMw+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760423849; c=relaxed/simple; bh=ibQgSkoNKfjEinMbrU1UbHO7wYvQd772aT7SponiIYw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hge2rBqD8qqmSb6WA8LE61cpt3wBETMQoPiALDy2aNKoWcsIUQatNqu4DIaqwm8hNKfksGEv7B4XK31AbYTfbFnPdChmMsJPYYCpJcVMwRzpeCPywxlmtX5BMd4s7M9mQYg/fZ69EYAUHGuFrQoHHyn7ZCgHoIXBsUGo1dUA1mI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=uYBg/4EL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WPbWCE/6; arc=none smtp.client-ip=103.168.172.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="uYBg/4EL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WPbWCE/6" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 30CBCEC0170; Tue, 14 Oct 2025 02:37:25 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Tue, 14 Oct 2025 02:37:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1760423845; x= 1760510245; bh=QmuXo3+ZmKbt3wm+WDptWod43pu/kVhknWh/Wc8Zyes=; b=u YBg/4EL6oBmYHNz/esmaCfPdhyNLyKmDBRrcm0rbNkpqapxFmc9FxLUrxND4FxD/ BawrD3mOsjJEX+iQd1DPcvQAxDeVGjK/fuJbUJXZ9vaG2DJe1V+BeJpAW1QcTjho T4DEh/9fQFNbboFyfze2ZQ0owdOz3FglUoJDK18e+Q8qJ906pCeOH/IF/AwUJdRe OfpnlmAJM9gg1lRc9H+ONVxQk1Sk6zaAO/9/Hz7rOYsy2nz0VTmA7cLEvGlaMLge dijcPe3sCoteSG1AWQZEk36S+jd0HdFnTHuy0+XlE8eGqNM5C5e3sJgnp4LxcN8a JzuMXlldUxVIGUIdyyhaQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1760423845; x=1760510245; bh=QmuXo3+ZmKbt3wm+WDptWod43pu/kVhknWh /Wc8Zyes=; b=WPbWCE/6iFXxiW+KakDW2gqSIaNM9hEwPilmAOGA7Wcl8ogsY9q 8uV701Wr1Z1QkCzsnznB1k0r0GbDi8JbuDfWpfFeV5elBrbMLD3fDfxOHUhgsGpO UtVXfkimDo3pifcPbhZpp7MTV9t9tbFaMamCKumoRCOFIhk2OqP8dsvcqm81MEk/ LYpW8AXr7Z2+fPF0BrLbbWbEDD5eSIaGSVtbenUAke4q71ug+3MyDtN0xNtNY4iT 7zgGCQcKiT6MRPrWLLGxkJ7UMNIdZnwneAq/zP8QX6BdTWO+4I8oLQHJmDLHEJZF RLv5SXtleDeOIYC2n+sKkvgeQzKe9TbCG3A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduudelkeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtjeenucfhrhhomhepufgrsghrihhn rgcuffhusghrohgtrgcuoehsugesqhhuvggrshihshhnrghilhdrnhgvtheqnecuggftrf grthhtvghrnhepgefhffdtvedugfekffejvdeiieelhfetffeffefghedvvefhjeejvdek feelgefgnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsugesqhhuvggrshihshhnrghilhdr nhgvthdpnhgspghrtghpthhtohepledpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh epvgguuhhmrgiivghtsehgohhoghhlvgdrtghomhdprhgtphhtthhopegurghvvghmsegu rghvvghmlhhofhhtrdhnvghtpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrgh dprhgtphhtthhopehprggsvghnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohephhho rhhmsheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepfihilhhlvghmsgesghhoohhglh gvrdgtohhmpdhrtghpthhtohepnhgvthguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhg pdhrtghpthhtohepvghrihgtrdguuhhmrgiivghtsehgmhgrihhlrdgtohhmpdhrtghpth htohepmhhkuhgsvggtvghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Oct 2025 02:37:23 -0400 (EDT) Date: Tue, 14 Oct 2025 08:37:22 +0200 From: Sabrina Dubroca To: Eric Dumazet Cc: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , netdev@vger.kernel.org, eric.dumazet@gmail.com, Michal Kubecek Subject: Re: [PATCH net] udp: drop secpath before storing an skb in a receive queue Message-ID: References: <20251014060454.1841122-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20251014060454.1841122-1-edumazet@google.com> 2025-10-14, 06:04:54 +0000, Eric Dumazet wrote: > Michal reported and bisected an issue after recent adoption > of skb_attempt_defer_free() in UDP. > > We had the same issue for TCP, that Sabrina fixed in commit 9b6412e6979f > ("tcp: drop secpath at the same time as we currently drop dst") I'm not convinced this is the same bug. The TCP one was a "leaked" reference (delayed put). This looks more like a double put/missing hold to me (we get to the destroy path without having done the proper delete, which would set XFRM_STATE_DEAD). And this shouldn't be an issue after b441cf3f8c4b ("xfrm: delete x->tunnel as we delete x"). > Many thanks to Michal and Sabrina. > > Fixes: 6471658dc66c ("udp: use skb_attempt_defer_free()") > Reported-and-bisected-by: Michal Kubecek > Closes: https://lore.kernel.org/netdev/gpjh4lrotyephiqpuldtxxizrsg6job7cvhiqrw72saz2ubs3h@g6fgbvexgl3r/ > Signed-off-by: Eric Dumazet > Cc: Sabrina Dubroca > --- > net/ipv4/udp.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c > index 95241093b7f0..3f05ee70029c 100644 > --- a/net/ipv4/udp.c > +++ b/net/ipv4/udp.c > @@ -1709,6 +1709,8 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) > int dropcount; > int nb = 0; > > + secpath_reset(skb); See also the comment for udp_try_make_stateless: /* all head states (dst, sk, nf conntrack) except skb extensions are * cleared by udp_rcv(). * * We need to preserve secpath, if present, to eventually process * IP_CMSG_PASSSEC at recvmsg() time. * * Other extensions can be cleared. */ It looks like this patch would re-introduce the problem fixed by dce4551cb2ad ("udp: preserve head state for IP_CMSG_PASSSEC"). > + > rmem = atomic_read(&sk->sk_rmem_alloc); > rcvbuf = READ_ONCE(sk->sk_rcvbuf); > size = skb->truesize; > -- > 2.51.0.788.g6d19910ace-goog > -- Sabrina