🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7322

Re: [PATCH net 1/4] sctp: purge abandoned I-DATA fragments by stream and MID, not by TSN

#7322
From: Tim Budding
Date: Mon, 26 Oct 2026 05:27
131 lines
16890 bytes
On Sun, 25 Oct 2026 12:08:47 +0000, netdev-bot+sashiko@kernel.org wrote:
> > +		if (event->stream < sid)
> > +			continue;
>
> [Severity: Low]
> Each call to sctp_intl_reasm_flush_mid() starts at the head of the queue.

[...]

Agreed. Walking each queue once per I-FORWARD-TSN would be a separate
change. I could send that to net-next.

> > -	/* purge the fragmentation queue */
> > -	sctp_intl_reasm_flushtsn(ulpq, ftsn);
>
> [Severity: Medium]
> With the TSN-based purge removed, what frees an unordered fragment of an
> abandoned message that arrives after the I-FORWARD-TSN naming that
> message has been processed?

[...]

> Should the commit message also mention the lost rwnd and receive buffer
> space? Alternatively, could these fragments be dropped when they arrive,
> or when the cumulative TSN moves past them?

Correct, and the commit message is wrong to say such fragments stay
until the association is freed. An unordered fragment of an abandoned
message that first arrives after the last I-FORWARD-TSN naming that
message, with a TSN above the cumulative TSN, can't be reassembled. It
keeps its rwnd and receive buffer charge until a later unordered skip
on that stream with the same or a higher MID, a reset, or teardown. At
the tail of reasm_uo it also stops reneging, as any fragment below the
cumulative TSN already can.

One late fragment is enough if nothing after it has arrived: the
receiver then delays its SACK for the I-FORWARD-TSN, the fragment fills
the gap within that delay, and the sender never names the message
again. With the last fragment of an abandoned three-fragment message
arriving in that window, that fragment stays queued (RX_QUEUE 1232). A
duplicate can't do it, as the TSN map drops the second copy.

Before this patch a later I-FORWARD-TSN covering its TSN would have
freed it, so if another message is abandoned later, this patch keeps
it longer. Without such a later I-FORWARD-TSN, this patch frees more
than before: in the same test, the TSN-based purge leaves the
message's received fragments above the New Cumulative TSN queued
(RX_QUEUE 2464 without the delay), and this patch frees all but the
late one.

For an ordered message the same late fragment aborts the association
instead: its MID is below the next expected one, so
sctp_validate_idata() fails. That happens on net today as well. I
could look at it separately.

Freeing fragments once the cumulative TSN moves past them doesn't work
with interleaving: a live unordered message can have fragments below
the cumulative TSN, and freeing those is the loss this patch fixes.
Dropping late fragments on arrival needs new per-stream state, the
highest skipped unordered MID, which must be cleared on resets and must
not go stale when MIDs wrap. I'd rather do that in a separate patch
than grow this fix (question at the end). Either way, v2 will spell out
the cost in the commit message.

> >  	/* abort only when it's for all data */
> >  	if (ftsn == sctp_tsnmap_get_max_tsn_seen(&ulpq->asoc->peer.tsn_map))
> >  		sctp_intl_abort_pd(ulpq, GFP_ATOMIC);
>
> [Severity: High]
> Can this branch still flush the whole ulpq for an ordinary I-FORWARD-TSN?

[...]

> A later patch in this series, "sctp: don't treat an I-FORWARD-TSN as an
> association reset", seems to address this. It drops the max_tsn_seen
> check from sctp_report_iftsn() and makes the stream reset paths call
> si->abort_pd() directly. This patch is tagged for stable on its own.
> Should that change be folded in here, or should the two be backported
> together?

Yes. At this commit an I-FORWARD-TSN whose New Cumulative TSN is at or
above the highest TSN received still takes that branch, and
sctp_intl_abort_pd() frees every queued fragment, including those of a
message still being received on another stream: the same loss this
patch fixes below the leading edge. If that message is ordered and in
partial delivery, its MID is also skipped, and the association is
aborted when its next fragment arrives. With this patch alone the
ordered and unordered tests pass and leading_edge fails. The later
patch fixes it. v2 adds a leading_edge case without partial delivery,
which shows the loss directly.

I kept the two apart because they are different mistakes in
sctp_report_iftsn(): the TSN-based purge, and treating ftsn ==
max_tsn_seen as a reset. But they share the Fixes: tag and the
symptom, so folding them is reasonable too. The later patch needs
patch 2 and the new pdapi_seq patch (see the reply to 3/4), and
neither of those needs this one, so folding would mean those two
first, then this patch and the later one as a single patch (question
at the end). If they stay separate, this commit message will say in v2
that the leading-edge case is only fixed by "sctp: don't treat an
I-FORWARD-TSN as an association reset". All three fixes are Cc: stable
and apply cleanly, in order, to the v5.10 through v6.18 release tags.

> >  			sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
> >  						  GFP_ATOMIC);
> >  		}
> > +		sctp_intl_reasm_flush_mid(&ulpq->reasm_uo, sid, mid);
>
> [Severity: Medium]
> This is a pre-existing issue, not one introduced by this patch. Does the
> new flush leave unordered partial delivery stuck when the skipped MID is
> the message currently being partially delivered?

Yes, and that is the next patch in this series, "sctp: abort unordered
partial delivery when its message is skipped". At this commit no abort
notification is sent and the next unordered message on the stream is
delivered as the rest of the skipped one. The uo_pd test fails at this
commit and passes from the next patch on.

Xin, Marcelo, two questions for v2:

1. Fold "sctp: don't treat an I-FORWARD-TSN as an association reset"
   into this patch, or keep it separate?
2. Should dropping late unordered fragments be part of this series, or
   a follow-up to net?

Unless you prefer otherwise, v2 keeps them separate and leaves the drop
to a follow-up.

pw-bot: cr
Technical Details
Message-ID: <20261026052706.187296-1-tim.budding@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351690-linux-kernel-netdev=dewy.ru
References: <20261024120627.837568-2-tim.budding@gmail.com> <179293012722.3134.13316596865856977030@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351690-linux-kernel-netdev=dewy.ru
From: tim.budding@gmail.com (Tim Budding)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/4] sctp: purge abandoned I-DATA fragments by stream and MID, not by TSN
Date: Sun, 25 Oct 2026 22:27:05 -0700
Organization: Usenet Network
Message-ID: <20261026052706.187296-1-tim.budding@gmail.com>
References: <20261024120627.837568-2-tim.budding@gmail.com> <179293012722.3134.13316596865856977030@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1230666"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:h+BXwpSLZpxVqmlL8viKpjXu2Xg= sha256:KzAGpAFVlUMqFWLXFZtf+wwXqEQ/I1vIat8hCRj6LUE=
	sha1:+wGw/Y9eaFrcZ1DQBGXeAcM4h78= sha256:myCCt+4KhA8+dDLJp8oitUSshsRahfO+EYICVv6vrSU=
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 82F6D125B87; Mon, 26 Oct 2026 08:28:10 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.148
X-Spam-Status: No, score=-3.148 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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=gmail.com
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 fP69HdhAPYWR;
	Mon, 26 Oct 2026 08:28:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-351690-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 156F7125B88; Mon, 26 Oct 2026 08:27:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 759536010C5; Mon, 26 Oct 2026 05:27:52 +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=1792992469;
	b=YssBZdLjf4ohgvJJVRmEvAoB8EhJ04Qq2WmUFJlqLEeAAAJeWvwOkAasVg3lk82IGqFc
	 IB+JCIJODDUw3xnQMZwo9XQLaPflcbjvBttoxhMDspiqAQGKsevwo5td1jylE2D4TEBl2
	 3XNMBMQzaagwoJddUSqrn5USPd3CzUEZ77wlOiMVhE5OFGk8WVCHcqO5JbnHUJk6W9c+T
	 pEUfjS2uwin4VqE7nTWes7xtzobfeCprZ5KcEHCoMr1FT8WppIVCtFTYPUg5l8pfXmjPQ
	 vz4DsJ4qwZfy4h4F4UZDJHHumzj96m69UcZR6e/wiCO39tqv75l+TJ40zlrFb3TpPzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792992469;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=RCGPlQz9/nbP749pKlUHj7iqUI3R/GYuLrhh68VMhX4=;
	b=MEBh0IloW9v6a6D7WVZUMEczOQGgPK14Lu4FULiEfSQVrEqhtI126ekc7/zv8AX087gc
	 SjEJYwQtngQh8WzD+WoaA7JHk5oAJLKRszGRSD7hSgTFuG+2AM2uaOikRxkizlYn3lkqG
	 Dkrk0OAkIibkZeloHXx8xtEirqmmzTIoxJ69nQhLHpNE2lbrWgkfKNMyRNWKFjrJMNp+h
	 e3oGLzCWbUo/iFC1vrBx6Ohsi1Dx5Ca/D2gofo9Pvu+ZqOKInizu7cXBkd0e45bjGQqdD
	 dOfS1KyqIbHFRIyYoDqaeEX6xL4aeBAX06bdqIkxoyA/kQyemzW7UPot4fGj5rbpMRg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=azji0Yvb;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 77937606A32F;
	Mon, 26 Oct 2026 05:27:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=azji0Yvb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792992458;
	b=DhE3BNpZHhd+khImBI8qNOnSZbWJzUUTjAHuXKwAti4p8nC9cOrIlDGaVexfhg8QsQIA
	 HcOaD0NQf5q/BnHzKyuoNu973/JUhfonf0s6+t+HaSUxE4bBrZfmaNEsO8mvPSZ5jpc/L
	 plsV5vNqJNUJtLjVLaaci1cVOlagaYd4e/TgQ1NEpYbYO9Qfs5CNyg/XlKk9CJp/TBpU8
	 hu5yHvXzhfGbt5fUNisFcFkAtRqPdg4lwu+KIHC0NVGvgDPko5dmoTQNdd1LUJk0YTm+L
	 wmb6kOEM1lunHZXc+yDLcuDxRjJSQjWm+Mh8OuJ1mpbWuCl22woKYpbb9MhhF2b+NxQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792992458;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=RCGPlQz9/nbP749pKlUHj7iqUI3R/GYuLrhh68VMhX4=;
	b=GuSlkh/ZqXO+teLbtGuKrPaGnXQwwmKezt6iwD8BmWi1dIcNbAxEzRrgDBK+Ah18t/GG
	 BpwwC8VuLKV32wlyDcwkUwQCj56I/JtsZUCv9sR9zZc+Vm4fW6i6Z+V8aKqPBK3p8tNSK
	 o6aD+uFtpfxifs3iwbJcVn0o5j6qM9JrwgdXtJcXSO12DnYvhxgJytA8OfBzcqGiUq1vL
	 8sBZT5/kyB0yldGeiaszz36Ywob+LeTccrFNp6C2f5bDFIuVGEvUqd4NPmfIeWQYHuuMR
	 Tw0aSB808t0x3K8NH8nVWdUO4yERBkKqn4F1RWlv3pQsTJoafDeGpi5fSiEsaljJ9iQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=azji0Yvb;
	arc=none smtp.remote-ip=74.125.82.172
X-Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B81C606A31B
	for <netdev@vger.kernel.org>; Mon, 26 Oct 2026 05:27:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B81C606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-369f33df08eso2111145eec.0
        for <netdev@vger.kernel.org>; Sun, 25 Oct 2026 22:27:38 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792992457; x=1793597257; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=RCGPlQz9/nbP749pKlUHj7iqUI3R/GYuLrhh68VMhX4=;
        b=azji0YvbQpXonPfhYaQOd4vN8DayEMzg6nrWZ+k9qUgnGH+Qty9ZoVl2H1T0DpoB2Y
         S6PuW3zslfumGLO5cOFGQXqvB6FlhXNk1x3xWJzy9jzfdAYMeGnxpgXkO+CHEFl6ILHf
         CSe5/3oPDppMSzPeO+hbvs3/kG6jBs3+IA3yc65Vo3LWxwbW6oT0qRXAY3cp/bJesXIh
         9qjma+u8mCKxWUdvJR4ixY6vkgsuUSn/3KJHzOnsY+TMu7akbq7B+spnmniyndnMOXfs
         Or0qSgsY25u8uz1rqn7FjFgUDPMKRFbovrmNX3RwS6i4cze+wwfJ7njGnbzAQbv4UYjU
         UMSg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792992457; x=1793597257;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=RCGPlQz9/nbP749pKlUHj7iqUI3R/GYuLrhh68VMhX4=;
        b=Kxtnlcwzaki4CA+rlJihoUmm+OFsVpguTxlHrICVPfA4wO45O6Ux16YiZ9MSxcx7Dz
         TkW5S0Ydf+fT+TCkEeUdlkbUEcUiUFgASkkzqKwlYHdCj2nToW9EYn17Upj2KHQM/xbg
         NV87sQNkPPCoZbWcNMl8daL1svggSCD7SXDd4Q+6jnVDgzHdZtp660soK0GJIOGD4pOr
         wVra+g2Ac0P3M++mLK7M+Y6EzHvfC2vW3vg9lNo991GMbIVN53cjPshn3IFTezvZyVR+
         HF83nINpbOcfWIY5IV76VOaRMJSyPQp8yntxfVnaC+3gMVi8hO10XiY5glX8cnYK9VtD
         gUpw==
X-Gm-Message-State: AFq9FYI2AdoUAiREmcdViUzXWk5BSfupZxXuhjOa02uzWxhFdv/fM1wT
	gsejMErdnJODnyAKriuAETYdo2q4W29e2pmAHywU7Sblvi6JRj4XKCt8
X-Gm-Gg: AYBFou2jepPJLQE6Xb1GKkvXiy+wfCz2kEkW5Gf4whZL2rPBV+sjug6EZ8LOnSZFpxd
	EEnXLGrCptRweeKjo9Xo7Qi7O7qylV15Lr9k33BRYM7B5ZGfJJo+jI8/7i1DNChLqt0uWLVOvxO
	6XtonLEO9urPkyqQn87jxz+E1sg4xAQCvhMN9nSXJ0nxTHeHij8ZSAEWZmi02HFO1ukEXbxIGoS
	rxQv6m78tfs9LckC4a7q1Mcb9ZZ+5vvdNB6SE3abiC/79lx66IWMyDxu+ZK78KfPooyANWSUZ11
	KHyTJWEmlfAxaAtzsAsHExRxFCK8zyz9rj19SUEtER6AtQuDpiOqL5vKfOrqPLHmMSBL/yuj9kU
	b/kmDFurOgRmdOlIxUdk2P8oAA59jGbmPjuHO6M7w5vb2cfEOHbx3bLd9KDljg3FLchj6hagxGB
	xGCF9h7BpfdHbHVtlx/GNoGP7SbEFZuC03ZAXBClT4K84u9HSDJtmXX3q3svG2U3GcbDo2pkjP+
	G6pQ3wuxjNnc0ZoQlAAodRHqKm8W86osczsaTvByVIvDeL3lYCQGUFOy7HhCONzw6aJAs3N8awn
	lsXxtW7Uew6J+T2aDPFpS/DdTw==
X-Received: by 2002:a05:7022:3b8a:b0:166:f097:6f12 with SMTP id a92af1059eb24-19934a9278cmr9164130c88.15.1792992457049;
        Sun, 25 Oct 2026 22:27:37 -0700 (PDT)
X-Received: from localhost.localdomain ([136.25.42.214])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-198a1bfaebfsm21437866c88.15.2026.10.25.22.27.35
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sun, 25 Oct 2026 22:27:36 -0700 (PDT)
X-Cc: netdev@vger.kernel.org,
	linux-sctp@vger.kernel.org,
	lucien.xin@gmail.com,
	marcelo.leitner@gmail.com,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	shuah@kernel.org,
	linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <179293012722.3134.13316596865856977030@kernel.org>
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