Article View: linux.kernel.netdev
Article #26657Re: [PATCH net] sctp: validate SACK gap-ack block ranges
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 02:18
Date: Fri, 04 Dec 2026 02:18
178 lines
14348 bytes
14348 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message understates what the new check does, and
the drop behaviour it chose has costs.
- [Low] The patch fixes a bug that a remote peer can trigger.
- [Low] The commit message gives 'RFC 9260, Section 12.4' as the
requirement for the new abort in sctp_sf_eat_sack_6_2()…
- [Low] The commit body is formatted as an email and would end up in git
history that way.
--
sctp: validate SACK gap-ack block ranges
This patch adds a check of the Gap Ack Blocks to sctp_sf_eat_sack_6_2(),
run before the SACK is queued for processing. A block with a zero start,
an inverted range, or a start at or below the previous block's end causes
the packet to be discarded. A block that ends past the last sent TSN
aborts the association.
> The patch validates Gap Ack Blocks before processing the SACK. It
> discards zero, inverted, overlapping, or out-of-order ranges. If a
> well-formed block acknowledges a TSN that has not been sent, the
> association is aborted as required by RFC 9260, Section 12.4.
[Severity: Low]
Is RFC 9260, Section 12.4 the right reference for this abort? As far as I
can tell, that section is "Protection of Non-SCTP-Capable Hosts" in the
Security Considerations. It doesn't seem to require an abort when a Gap
Ack Block acknowledges a TSN that hasn't been sent. I haven't been able to
check the RFC text directly, so this needs confirming.
SACKs that used to be tolerated now tear down the association with
ECONNABORTED. Could the commit message cite the normative text that
requires this? If that text is only a SHOULD or MAY, could the message
say so?
[ ... ]
> Apply the supplied fix.patch and rebuild the kernel:
>
> git -C linux apply --check sctp.patch
> git -C linux apply sctp.patch
[Severity: Low]
This isn't a bug, but the script downloads fix.patch and then applies
sctp.patch, so it won't work as written.
The commit body is also formatted as an email. It opens with "Hello," and
has "Thanks, Shawn Shao" after the Signed-off-by line, and both would end
up in git history. Could the greeting, the closing and the long
reproduction script move below the --- line, or be trimmed?
The tested version string "v7.3-23903-g7cd8495c0f162 (Linux 7.4.0-rc4)"
also looks inconsistent.
[ ... ]
> Signed-off-by: Shawn Shao <shawnq1@163.com>
[Severity: Low]
Should this have a Fixes: tag? The unchecked subtraction being guarded
against dates back to the initial git import:
net/sctp/outqueue.c:sctp_sack_update_unack_data() {
...
for (i = 0; i < ntohs(sack->num_gap_ack_blocks); i++) {
unack_data -= ((ntohs(frags[i].gab.end) -
ntohs(frags[i].gab.start) + 1));
}
...
}
sctp_outq_sack() has long assumed that the last block holds the highest
end, which the new ordering check now enforces:
highest_tsn += ntohs(frags[gap_ack_blocks - 1].gab.end);
Something like this would help stable backporters pick up the fix:
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index 6a4205de0aa69..79d297af661d4 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
[ ... ]
> @@ -3497,6 +3501,24 @@ enum sctp_disposition sctp_sf_eat_sack_6_2(struct net *net,
> return SCTP_DISPOSITION_DISCARD;
> }
>
> + /* Gap Ack Blocks must describe sent TSNs in ascending order. */
> + frags = (union sctp_sack_variable *)(sackh + 1);
> + num_blocks = ntohs(sackh->num_gap_ack_blocks);
> + max_offset = asoc->next_tsn - ctsn - 1;
> + for (i = 0; i < num_blocks; i++) {
> + start = ntohs(frags[i].gab.start);
> + end = ntohs(frags[i].gab.end);
> + if (!start || start > end || (i && start <= last_end))
> + return sctp_sf_pdiscard(net, ep, asoc, type, arg,
> + commands);
[Severity: Medium]
Should a single bad block discard the whole packet here?
sctp_sf_pdiscard() queues SCTP_CMD_DISCARD_PACKET, and
sctp_cmd_interpreter() handles that command by marking the entire packet:
net/sctp/sm_sideeffect.c:sctp_cmd_interpreter() {
...
case SCTP_CMD_DISCARD_PACKET:
/* We need to discard the whole packet.
* Uncork the queue since there might be
* responses pending
*/
chunk->pdiscard = 1;
...
}
After that, sctp_inq_peek() and sctp_inq_pop() stop returning the
remaining chunks of the packet:
net/sctp/inqueue.c:sctp_inq_peek() {
...
if (chunk->singleton ||
chunk->end_of_packet ||
chunk->pdiscard)
return NULL;
...
}
So SCTP_CMD_PROCESS_SACK is never queued, and the SACK's otherwise valid
Cumulative TSN Ack and a_rwnd are ignored. ctsn_ack_point doesn't
advance, the peer rwnd isn't updated, and the transmitted queue isn't
freed. Any DATA or control chunks bundled after the SACK in the same
packet are dropped too.
Suppose a peer always sends blocks in this form. Would its SACKs then
always be ignored? The cumulative ack would never move, and the
association would eventually fail on the T3-rtx retransmission limits.
Before this patch, sctp_check_transmitted() and sctp_acked() matched each
block on its own, so these SACKs were still processed.
The out-of-order cumulative ack check just above returns
SCTP_DISPOSITION_DISCARD, which drops only this chunk. Would that, or
skipping the bad block, fit better here?
The commit message says the patch "discards zero, inverted, overlapping,
or out-of-order ranges". In practice the whole packet is dropped. RFC
9260 Section 3.3.4 also seems to say only that Gap Ack Blocks SHOULD be
isolated. Is strict ascending, non-overlapping order actually required?
> + if (end > max_offset)
> + return sctp_sf_abort_violation(net, ep, asoc, chunk,
> + commands, err_str,
> + sizeof(err_str));
> +
> + last_end = end;
> + }
> +
> /* Return this SACK for further processing. */
> sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_CHUNK(chunk));
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179613469562.187341.14965162957276514602.1796134695.3-1-shawnq1%40163.com
Technical Details
Message-ID:
<179635072618.3146.12542354371056584235@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376970-linux-kernel-netdev=dewy.ruReferences:
<179613469562.187341.14965162957276514602.1796134695.3-1-shawnq1@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376970-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] sctp: validate SACK gap-ack block ranges Date: Fri, 04 Dec 2026 02:18:46 +0000 Organization: Usenet Network Message-ID: <179635072618.3146.12542354371056584235@kernel.org> References: <179613469562.187341.14965162957276514602.1796134695.3-1-shawnq1@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2654344"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Tn0f2gHGFhlCwP3IOnYoYqSSIa4= sha256:svt9SbjqSPVnJ+yDyVoctR8UqglQxS8xtXpvqWwzGjY= sha1:mROKODgXf/weAlgvMG78uavQ8Ag= sha256:weAHTd1TcZl7Z0ojY9NfKrgwnU75WJRvgOIjFbs0sJ8= 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 7434C117AA3; Fri, 4 Dec 2026 05:19:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, 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 lQ5aiiOfsdKo; Fri, 4 Dec 2026 05:18:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376970-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 0D038117A7E; Fri, 4 Dec 2026 05:18:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id F2C7523C60; Fri, 4 Dec 2026 02:18:48 +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=1796350728; b=HF3i3ew244yYygHQ+Wb5IENy58Od+7aF0yCgF4Dy1vvZu4F3W/zVOLo6CGDyCdVNoWwr G7CzlUaao9waavgXR1DkWyE2cLS+K7xA0MV9WiR1wQo1ppvxoyzB7z9FGM3tvg/LBztbj rikDWQr1ubIowMgqXqhxn7oRDM2+GOerNkR1ywX+N6WTrAd6wuV5UCgO4m7hOM3M9VSUK 4LmIXexLyxC8YO/dAan7kjCt8pr4EgO3CJsaeKrC2Y8AuHthZbrilSuJudmmMU9kBxsOv nf2UxXX4XrYuVXkP5oe7UuvWVt/HtmvTUiTCMGnWNr5qcS30ZYNddNkQ7ZbvUuV8/Dw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796350728; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=VQsHSmTwo/9vPkAhyeRqnOC92c67151SFA1QOqdWXik=; b=aj1rT/0IEiQwLojvZzmSIbt5gfP/yk0DOkED5BGQAnrugc65WJZE5U+Cm8HccgMX0QXv UtY53Cp8g0GIw6kwwaAMDfloB0rVfvad43bzA7PdeJ0raDxPalkQkSyLokCiAkT0oHUoP zGBdcZ1+Y4JQ/nxS34tezdCq9ctozlbt5fD4kwPsFNWIr46JCA1RDXIcAWNRZ4MsMv/sK JbEJrhoeY+K95Nmkfk/XSwGLzaVK+fRKFPoOHPHHcHQhNRLv5MaVGFSTOMwJfB8mv6dgk 6xa2Zw3PykkPHiUX1oEfYxmxt7bsufJgnwaIPUbl5kncXR80I2qbFd2ioJj/uFyiLxQ== 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=b0bUPeMS; 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 86BEF606A335; Fri, 4 Dec 2026 02:18:48 +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=b0bUPeMS 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=1796350727; b=oA40LjvyNOSqd4Sqs1pzRvSvJHucE0BMz+MmthFHfi/WfI8fUQiQXmMl/eLEdj/1Kbgi Ghh6WfeDbHUBE4l8p4GrLV2V3NLOfbsLEAZO5hjtMX7LqgRkqFFKPykB5vKVolengjt/b MJcOQJ8U4oqZQ/cLhmUb0LNHV0SxYLC4yxy+hdzwAP3vjP8snmJK6zmKVZb/HrIQkJ9eW ZGftlCnXqQU7AXFfUUOlud3wH7RYqJseNmY1gjKrZz3MQg7xe1u3+7gDkY0tX5kvP3w9f 2P7PXZ6ItxN+kobBtdMFmpJlmLG7NshcV7rIzOaN+DPvBjY6VvBXQTkKtFV/OgntP2w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796350727; 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=VQsHSmTwo/9vPkAhyeRqnOC92c67151SFA1QOqdWXik=; b=HGk96qSeG2B2RVrTRnBsN+FtaV2mOjlxzVqAqYRddwGkY8mhj4oih4i+nCqA8at3Paey tWH0QQzrXq423EZQuVnAbfgqrOwSOW9qrPwxGkk30KxQsz/EaMcdNSmS6vMD8u1m5qEJC 167l8puz92PqWEPYxB4eMRTHOFVOh+azJnEBXVL7jZ9JBgpg3Ke3ysMEJBJalebfN4tg+ lD4V+yZTFuR8lOHJbc9s7A6Uv0y6V//WlesLxfj7J6ZQ2dvBflYtBQbmFfN7KuGPH9VLW IZhwAIkAFksFGTt2w8JPjHq/Z7kMYBFIWrowtdll96lW96PvIcTkbabegEh1J4FuXUw== 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=b0bUPeMS; 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 A535D606A32C; Fri, 4 Dec 2026 02:18:47 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F751F000C2; Fri, 4 Dec 2026 02:18:46 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796350727; bh=VQsHSmTwo/9vPkAhyeRqnOC92c67151SFA1QOqdWXik=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=b0bUPeMSTfTmIDIz9xFymbP6NtWWVvqUA2pLc83czWwq1Xw6k56+SJRuNyr41zWPo RYGTerspI65QceoxgqEIFOh+cAM61mNLexKEdQrMLWbCpKNHRJm5dUXGAYV1GXf0P5 0w8pkGdIfqCW2PUjkvwwoNSdQyWq13qXsJ5AXCq01u53lGzbY94NcKAeyF6n+/lhW0 Cw0UzxTPDst+rLjLRxelJZjZsdojrKzlQG4bPk0t6Ukse4miMYL6icW3bywYMq7tv6 j7Mx86FDS7VKsS/YORTBwLGNuVGo8VLp5a+rrEP8635OoymEhNbJAkkOzUaHkn5327 85DwHNs2UI27A== X-Cc: marcelo.leitner@gmail.com, lucien.xin@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, linux-sctp@vger.kernel.org, netdev@vger.kernel.org X-In-Reply-To: <179613469562.187341.14965162957276514602.1796134695.3-1-shawnq1@163.com> X-sashiko-severity: Medium 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