🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16717

Re: [PATCH net v2] sctp: revalidate association sockets after locking

#16717
From: Jakub Kicinski
Date: Sun, 15 Nov 2026 18:09
42 lines
9803 bytes
On Fri, 13 Nov 2026 11:28:02 +0800 Yong Liu wrote:
> Subject: [PATCH net v2] sctp: revalidate association sockets after locking

1. please use the problem you're solving for the subject, don't
describe the code change, so that the subject doesn't change between
revisions
2. please don't send new versions in reply to old ones

> SCTP timer callbacks and ICMP error lookup cache asoc->base.sk before
> acquiring its BH lock. An accept or peeloff can move the association to
> a new socket in between. Processing under the old socket lock can then
> race with an abort on the new socket that tears down the association's
> queues. Transport and association references do not keep those queues
> alive. With mdelay() instrumentation widening the race, KASAN reported a
> slab-use-after-free in sctp_chunk_abandoned() from the T3 retransmit path.
> 
> The ICMP error handlers also reread asoc->base.sk after lookup, so they
> can use the new socket without holding its BH lock. In particular, the
> PMTU handler can reach the same retransmit path, while protocol-unreachable
> handling can run the state machine directly.
> 
> Recheck the association's socket after locking it in the timer callbacks.
> Treat a mismatch like a busy socket and use the existing reference-counted
> retry path. Pass the socket locked by sctp_err_lookup() to both IPv4 and
> IPv6 error handlers, including their UDP encapsulation callers. Defer PMTU
> and protocol-unreachable processing and ignore redirects when that socket
> no longer matches the association. Require a matching socket for immediate
> error reports as well.
> 
> Use READ_ONCE() for the socket pointer reads in the timer, ICMP, receive
> and backlog paths, paired with WRITE_ONCE() in sctp_assoc_migrate(). Take
> the new socket reference before publishing its pointer. The cached socket
> is protected by BH context and the endpoint's RCU-deferred sock_put().
> 
> The issue was discovered and fixed by Qihoo 360's Tulongfeng multi-agent
> system.

3. please remove this, there's no place in commit message for
advertising
-- 
pw-bot: cr
Technical Details
Message-ID: <20261115100933.75ae0534@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.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-363787-linux-kernel-netdev=dewy.ru
References: <20261110120212.1110283-1-pkfxxxing@gmail.com> <20261110120212.1110283-2-pkfxxxing@gmail.com> <20261113032805.1447885-1-pkfxxxing@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.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-363787-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] sctp: revalidate association sockets after
 locking
Date: Sun, 15 Nov 2026 10:09:33 -0800
Organization: Usenet Network
Message-ID: <20261115100933.75ae0534@kernel.org>
References: <20261110120212.1110283-1-pkfxxxing@gmail.com>
	<20261110120212.1110283-2-pkfxxxing@gmail.com>
	<20261113032805.1447885-1-pkfxxxing@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1867837"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:p27ss+PNAhzgyNryZuxkUCB/1CM= sha256:iVDhc6QnG6tYHquvZl04P4KQJ21E7X+SnwgXzOYQk28=
	sha1:oEmhIs0wO4Di2ErN3QdQSIVYMz8= sha256:URPZ81rShK+GRM8QtrZsCp6dbQFYAobvdB350ZROgY4=
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 14488114A25; Sun, 15 Nov 2026 21:10:00 +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 fVjC-KLHly7K;
	Sun, 15 Nov 2026 21:09:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363787-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 603CD114A14; Sun, 15 Nov 2026 21:09:44 +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 21C0235316; Sun, 15 Nov 2026 18:09:41 +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=1794766181;
	b=JPTAnYA7hC89iHRCdbY5o6ll1lhhQOYBy/qt33h9sKipK9gswdvQ64Cqziqm5U6vLWWC
	 blZDymeW2qHCLIZcBaWn4PwDmt0tSw4SOBbeTVvvfhM0X28BRiwFy6o0Hz1MtCnjnPdXB
	 Oh9l1XDmDDuK6PrHBY+sWPOne/GKcDRs0rL2fWvTBCZ5UcHRevGKApht1JHk1AYGWe4jm
	 Dh7PD+oo9mKaXUREKZjyJkHNXv9M8kuGkCEUZXpbWFNyA8qPMyhk/vpIJVXVOV9JlF0/H
	 hYbg8HA99pnKWfEG46NpIHoDVYwJy6WrAkJdZYyrKYAkaKZD6trgydc6HxW410VF/+w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794766181;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=D2+Svi0kHYvgSG9q/RUfK7SbfgBZOy38SUfssP6B2Jc=;
	b=1OY/hvQB/zJou6SBViwholV/1pRdysB2GFfT3s7Z00CsMhz7++Hpbr2UNaMb0/h5nV5K
	 HxLdTf4C45geW/lPzSxjeLaVSbHrbIhjl7XafEcdwARoku+zzzT/krf71fIHQCcn/AD+E
	 JNIafU/XroSzOBOtHVqnK1oOLJ5OpC1pJCZY5LmAwh7JISEJrdd46y/7EzqQvaE+ACGrN
	 y/MrRswmhHbf5LFI4CKi7kVLY800Tu9ceT1yOFOwUui4sbaJ7B6pgbu8D2ausKNDSprQR
	 bcJxLG07dE1sl/08TQ/d5+4wIXmZ6fm10gsjbQMCBVAbC70vDLgHGKxqfePzKXnJORw==
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=ECemnQF1;
	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 E6138606A332;
	Sun, 15 Nov 2026 18:09:40 +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=ECemnQF1
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=1794766175;
	b=hNFaNuhmfh6Hv6eoNdb1oGf0/kMOwLLc33Ax1MjDfD9yNHyusLz2903Vff4oa6Z7j/8+
	 7e3e9I/4OwIzTca6qn93FZjqveo0tF+si5sowxMlvPMBPCdM8cX8aqKG+kfT4hPLsUs7o
	 e1Hm0GQPtUZ1y1ndFEIquwU1qJH+kVfVbk2UYMXQnBzRect5Rc4hgv6bCbqA9lcm7+e6Q
	 sn70B4moVLNRAQu+2C5LqHKC+TLsrKdWn8sbRmhsKb4rJHGpOUdHn8yc7Gst5sSQYutVX
	 4yy8YmCCzcqGjb3gSATEWj8XQS/wndQJKi3znyXmQwnnWL893fW5sDRt5H4f1bw75Cg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794766175;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=D2+Svi0kHYvgSG9q/RUfK7SbfgBZOy38SUfssP6B2Jc=;
	b=qTojWlFS+ksXh7ZxVEFkQBYj7+AVzFt16sE3cSFKqj+KRNsYbTCnHZgAsMssdpe/btSk
	 93v3TNCtF1KyJnC1qyQEZycs2bY2zmUtXcNzU5832onWw0j1CvOuLCPW84mGLOIud0NXL
	 LLPljLbK65kLQKZ76rgKS8Pg+S5VQLo6M1Kz70RMLq6kqdjy6QzHZGVlgNIbrHSWsxL/g
	 R5FhtyWjsGvQW75VyNQc1uzstxmptQz3xfG38OuS5Kbd4lUNyvouCej5THGwmAShudPhs
	 bOH3c+Ps3qmNp/kmtUb7LQifkILT2PvhNaFSSIAMQ1BJPFqBpeZNe4WChtDrs6N4BoQ==
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=ECemnQF1;
	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 0DDA5606A31E;
	Sun, 15 Nov 2026 18:09:34 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E861F000C4;
	Sun, 15 Nov 2026 18:09:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794766174;
	bh=D2+Svi0kHYvgSG9q/RUfK7SbfgBZOy38SUfssP6B2Jc=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=ECemnQF13rWc22V0N9rtbYuj/f2QbXhKatASZsROFbBaynD+9hFW3EaUgdWXhsntm
	 vZfkNRtOrUmu/1zZ5MOg0k27df0F/+F1MB9DByeGozv3Ks3JF+pxBgtyBijKBvo3Lk
	 ifs8N1YTQO2EN1T2LAgBrFyVc9HmRSoqBVCi9dObTIhNTRgnYitKena8HG7+XLzenq
	 PWssUW3E9Pj/5fptolIRR4dMoHl/x5H2YEPAHAqOi1yGljLlsf2CO00KjXGy1GG762
	 z9oWCd2o/J17FwHGjaMFnQC6xz8wTXuZMyFthsU1sUgzqiUPGpQCGnlzFXx+C1uq2b
	 Fc8WfLMflz6tw==
X-Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>, Xin Long
 <lucien.xin@gmail.com>, linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261113032805.1447885-1-pkfxxxing@gmail.com>
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