Article View: linux.kernel.netdev
Article #25447Re: [PATCH net-next v15 4/4] net/sched: cake: hash before segmenting and reject an overlong split
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 19:43
Date: Tue, 01 Dec 2026 19:43
261 lines
17989 bytes
17989 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 (1) · Low: 1
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] Several claims in the commit message do not match the code or
the tree.
- [Medium] This commit tags every segment with QDISC_DROP_OVERLIMIT
before qdisc_drop_all(), with the comment "__skb_gso_segment() leaves…
- [Medium] Under an mq-style parent (cake_mq, mq, mqprio), the new split-
admission check gives wrong answers.
- [Low] This commit opens with "The Fix:" but has no Fixes: tag or stable
marker.
Pre-existing issues:
- [Medium] cake_enqueue() now snapshots flow_mode once with
READ_ONCE(q->config->flow_mode) (sch_cake.c:1802).
--
net/sched: cake: hash before segmenting and reject an overlong split
This patch splits cake_hash() into a side-effect-free cake_hash_keys() and
a cake_hash_resolve() that runs only after admission. It also moves the
split-GSO segmentation ahead of flow resolution. Before linking any segment,
it sums the segment lengths and refuses the split if its own backlog or an
ancestor's backlog could exceed the ceiling.
Link: https://lore.kernel.org/netdev/179231933068.3135.80340792633077986@kernel.org/
Link: https://lore.kernel.org/netdev/179269577270.3135.16072065138845192450@kernel.org/
> The Fix: with CAKE_FLAG_SPLIT_GSO, cake computes the flow keys and then
> splits a GSO skb into segments it accounts individually. Key extraction
> must run on the unsegmented skb -- skb_gso_segment() can rewrite
> encapsulated headers to the inner ones -- and resolution must wait until
> admission, since it commits set-associative state a later rejection would
> leave mutated.
[Severity: Medium]
A few parts of the commit message don't seem to match the code.
The subject says "hash before segmenting" and the body says "Key extraction
must run on the unsegmented skb". Wasn't that already true before this
patch? The parent commit already has this above the split block in
cake_enqueue():
b = cake_select_tin(sch, skb);
idx = cake_hash(b, skb, q->config->flow_mode, flow_override,
host_override) + 1;
The only real ordering change seems to be that cake_hash_resolve() now runs
after the new admission check. That only matters because this same patch
adds the rejection.
The text "tagging only the head left the rest with a headroom-sized value"
and "Found by our review of an earlier revision of this series" describe
revisions that were never merged. The baseline cake split path has no
rejection, so it never tagged only the head.
The reproducer section says its example "is admitted" and that "The clause
is a defensive bound, not a proven one". Since there is no reproducer,
should "The Fix:" and "Conditions to recreate the bug" be reworded? Also,
none of the listed commands actually hold the tun fd open.
The body says "the split reserves two copies of its growth". The v14 -> v15
note says "reserve two copies of the split growth in the own-counter test".
The own-counter test in cake_enqueue() is:
if (unlikely(((u64)sch->qstats.backlog + 2 * slen > U32_MAX) ||
That reserves two copies of the whole segment sum, not the growth. The
1081327 figure (2162655 / 2) also only fits 2 * slen.
"The reconciliation's length is signed, so the segment-sum subtraction
cannot be mistaken for growth" reads like a functional fix. Does the (s64)
cast change anything? qdisc_tree_reduce_backlog() only passes len on to
qdisc_qstats_backlog_apply():
WRITE_ONCE(sch->qstats.backlog, (u32)(backlog - delta));
The old unsigned len-slen gives the same result modulo 2^32.
Finally, no function under net/ is called sock_free(), so "the tail
segment's sock_free()" doesn't match anything. Was sock_wfree() meant?
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
[Severity: Low]
The message opens with "The Fix:", but there is no Fixes: tag or stable
marker. Should there be one?
The earlier patch in this series, "net/sched: cap the accounted backlog
before it can wrap" (Fixes: 175f9c1bba9b), says:
"The ancestor-room check covers a split whose segments would grow an
ancestor past the room: tbf, dualpi2, netem's corrupt split and cake."
Its sch_cake.c hunk only adds the qdisc_backlog_overflow() entry guard,
though. The cake split-path own-counter bound and the
qdisc_ancestors_backlog_room() call only appear in this commit.
Stable could pick up the earlier patch by its Fixes: tag without this one.
The cake split path would then still call qdisc_tree_reduce_backlog() with
no bound. Since the clause is described as "a defensive bound, not a proven
one", the runtime impact of that is unproven.
This patch also depends on "net/sched: cake: return the classifier result
to the caller" and "net/sched: cake: use a dedicated split-GSO list
iterator" from the same series. Could that dependency be recorded?
> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 25c7e20ec1239..f7ac265bfa176 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
[ ... ]
> @@ -1769,11 +1788,18 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> struct cake_sched_data *q = qdisc_priv(sch);
> int len = qdisc_pkt_len(skb), ret;
> u16 flow_override, host_override;
> + struct sk_buff *segs = NULL;
> + struct cake_hash_keys keys;
> struct sk_buff *ack = NULL;
> ktime_t now = ktime_get();
> struct cake_tin_data *b;
> struct cake_flow *flow;
> bool same_flow = false;
> + int flow_mode;
> + u64 slen = 0;
> + u64 growth;
> +
> + flow_mode = READ_ONCE(q->config->flow_mode);
[Severity: Medium]
This is a pre-existing issue and was not introduced by this patch. Now that
flow_mode is snapshotted here, what about the dequeue side? cake_dequeue()
still uses plain loads of q->config->flow_mode for the bulk host count
updates and for cake_get_flow_quantum():
cake_inc_srchost_bulk_flow_count(b, flow, q->config->flow_mode);
cake_enqueue() also still reads q->config->rate_flags with plain loads,
for example:
q->config->rate_flags & CAKE_FLAG_SPLIT_GSO) {
With cake_mq the config is shared. cake_mq_change()->cake_config_change()
writes these fields before taking any child's tree lock:
WRITE_ONCE(q->rate_flags, rate_flags);
WRITE_ONCE(q->flow_mode, flow_mode);
Suppose the dual-src/dual-dst bits change between a flow's enqueue and its
dequeue. Can hosts[].srchost_bulk_flow_count and dsthost_bulk_flow_count
drift? The saturating guards prevent wraparound, but not drift.
The baseline enqueue also read flow_mode live. The commit's narrower claim,
that extraction and resolution within one enqueue use the same mode, does
hold.
[ ... ]
> @@ -1790,12 +1816,53 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
[ ... ]
> + growth = slen > (u64)len ? slen - len : 0;
> + if (unlikely(((u64)sch->qstats.backlog + 2 * slen > U32_MAX) ||
> + (growth &&
> + !qdisc_ancestors_backlog_room(sch,
> + 2 * growth)))) {
[Severity: Medium]
How does this check behave under an mq-style parent such as cake_mq, mq or
mqprio?
qdisc_ancestors_backlog_room() crosses TCQ_F_NOPARENT and tests the
root's counter:
if (unlikely((u64)READ_ONCE(p->qstats.backlog) + extra >
QDISC_MAX_BACKLOG)) {
For mq-style roots, only mq_dump_common() writes that field:
WRITE_ONCE(sch->qstats.backlog, qstats.backlog);
That value is the u32 sum of every tx queue's child backlog at the last
dump, and the sum can wrap.
qdisc_tree_reduce_backlog() stops at the NOPARENT child, so the split
growth never reaches that parent. The helper's own comment says "A parent
that does not book it cannot overflow."
Suppose a dump leaves the aggregate within 2 * growth of
QDISC_MAX_BACKLOG. Would every child's growing GSO split then be refused
with QDISC_DROP_OVERLIMIT until the next dump changes the snapshot? Note
that RTM_GETQDISC dumps don't require CAP_NET_ADMIN.
> + qdisc_qstats_overlimit(sch);
> + /* __skb_gso_segment() leaves SKB_GSO_CB over
> + * tc_skb_cb.drop_reason; tag every segment.
> + */
> + skb_list_walk_safe(segs, seg, nskb)
> + tcf_set_qdisc_drop_reason(seg,
> + QDISC_DROP_OVERLIMIT);
> +
> + return qdisc_drop_all(segs, sch, to_free);
[Severity: Medium]
The same reasoning applies to the split refusals that "net/sched: cap the
accounted backlog before it can wrap" added to tbf_segment() and
dualpi2_qdisc_enqueue(). Should those tag each segment too? Both pass the
untagged list straight to qdisc_drop_all():
net/sched/sch_tbf.c:tbf_segment() {
...
consume_skb(skb);
qdisc_qstats_overlimit(sch);
return qdisc_drop_all(segs, sch, to_free);
...
}
net/sched/sch_dualpi2.c:dualpi2_qdisc_enqueue() {
...
consume_skb(skb);
qdisc_qstats_overlimit(sch);
return qdisc_drop_all(nskb, sch, to_free);
...
}
netem's equivalent path does tag each segment, through
qdisc_drop_reason(..., QDISC_DROP_OVERLIMIT).
SKB_GSO_CB_OFFSET is 32, so tc_skb_cb.drop_reason overlaps
SKB_GSO_CB->mac_offset/data_offset. __skb_gso_segment() writes
skb_headroom(skb) into that spot. __tcf_kfree_skb_list() then reads:
u32 reason = tc_skb_cb(skb)->drop_reason;
A headroom-sized value has no qdisc subsystem bits. It would therefore be
passed to kfree_skb_reason() as an unrelated core skb_drop_reason.
Won't tbf and dualpi2 split refusals then show the wrong reason in the
kfree_skb tracepoint and in drop monitor?
> + }
> + }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130183825.229246-1-jhs%40mojatatu.com
Technical Details
Message-ID:
<179615420343.3146.545600846329620433@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375333-linux-kernel-netdev=dewy.ruReferences:
<20261130183825.229246-5-jhs@mojatatu.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375333-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v15 4/4] net/sched: cake: hash before segmenting and reject an overlong split Date: Tue, 01 Dec 2026 19:43:23 +0000 Organization: Usenet Network Message-ID: <179615420343.3146.545600846329620433@kernel.org> References: <20261130183825.229246-5-jhs@mojatatu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1805460"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8vb0VqZ1SWh8AOl7ueH+k4MuZeY= sha256:JwYxJuh7f2R1H7XZ6PHqCu10YSkxVReO5LeXrHV40Fs= sha1:EELnP+rwATJ/tkBNyc1aGc5HdyE= sha256:xBv4QZNTUnH/6zP7Cbkhgi1Fe8FE/KVvh+admYS0YDI= 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 3AB56117485; Tue, 1 Dec 2026 22:43:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 yAhPyE26p6Wa; Tue, 1 Dec 2026 22:43:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375333-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 D234711747B; Tue, 1 Dec 2026 22:43:31 +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 F2F7027441; Tue, 1 Dec 2026 19:43:26 +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=1796154206; b=vr7p9dbp45lj+4KuszvZ/1NrnFfW3hJ1js+lj0F4yYORfX/M62c6bRfLCjffvSOOZC7P BsZJZAM181kbJ3cwzw+jMGyTMcEiOZgVYQX+YAnkmTgdqcog5DxGHXZobhPDkSeOM6sPM rlYss6bZedJ87flDoHaxqR+7FKe55NXQtP7ViP2tTQB98RCX5cy2T1/oQsSVsfOgbJf12 oGuVBbib7j3o2pgdWcPbtiPvWJ9AwfVNkLns4Ff3bdJu8zeSsN+2Wad+vUZdt+r/6/wJk X2ap41dWo4EHxUKDQlw3FKfzUsAcUct76e/0UhoeNbxZoirgLBSNov62sYgA/7gYSvA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154206; 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=+OVv8jtp+DeGJKyV5JwtXpKSW/dRfJDeFj6XRPTh7U0=; b=23KKEkSmm8ULQg7vAjgqdusOLqPMf3+skh3HDKEUCGuWGGv4NPuArLaw+X8GMK/+sDwV mVdJUgN+S9xK+gA+sDbiKfQgU0eeKWtVUYlZwKuY3dDdau6i19ZndIaJvYOwBULcb/Vv/ hwZu6FZeRgO+1yB9bIUfp0uXzrYTcfDvOFnmE1kZ30eNiWYLuz+Pl27lVyi+f5XWTDHW9 JuvWYa6fINeXT+JA3BJyjFFisnTDvy7h59Uz7agJZm2n2DOsMoDHFdAyw7acBFnfZqFQh zOj8ZUyyGS2QbsVRaVNA8hYDsWDWQgVAhB8yAIwlQaIiy9YB+TubkHnySoCKzCw2p1w== 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=i6IcT8qa; 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 0193D606A325; Tue, 1 Dec 2026 19:43:26 +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=i6IcT8qa 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=1796154205; b=UdiMq2yK8AUfjkPZ17sYAcmtZfZ8n81QSWyyKRE2NnHBKvScrDxsNvQhIkf43EPWtHFV pFBIbAwOF7kuTbU0ikPyKur+WusJOlsutLCMykQJxwyni5zBuJ+XdqHcrxpWuyI0iNyAe tijGRkAC5P1w5Xr6YjsvWap9xHtCPf4yYS+mMqcEN7KkPiqnGK628yBrZ+pRgr/AbkPI4 kn4Pl9/RRx9y2joprzziJ6xgtq6+Moh2IYxCzIKCqAwYp3GbWHaJ8TuFXvcXrshqVgpdB xh+rFQyKxah4T5Gg7F/qoCWN3FUzigl7DcQBPRy2NXE2sQNdR2XyKInYGSq/9X/7oYQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154205; 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=+OVv8jtp+DeGJKyV5JwtXpKSW/dRfJDeFj6XRPTh7U0=; b=rcSQI+umPtxH+HMLWqa4p+i8lV39pLcZfSJrGWwWlk8eYUOIz4jqhQXqpIjdTqacHUqC Oohs1pfkYLIKcPoU9Yx6XJvUdqcTccSld1p7Om9UvdUs8Y0BFZqHGNezKU7M+fz61mAR+ DA60OwVH6ZgYV8N0kpZ2/sl4Ni+bNCyU/5U6MOquVsxvOA3yr1WOgXDN3B0tJCV+4D+74 3MYVtbUmOaLq/fuxan9Kek1FNmvR+y9Kd+67AwTJgOuRKHrMrGez4F/bPhi1b8KzymZe5 mK9pSlj6dMurho1sFUDDFGcYoXJBuB8Eon5+UQGFDBTzzS5011kpHsNmzTCtLQlQ4Cw== 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=i6IcT8qa; 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 22CAC606A331 for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 19:43:24 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D89B11F000C1; Tue, 1 Dec 2026 19:43:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154204; bh=+OVv8jtp+DeGJKyV5JwtXpKSW/dRfJDeFj6XRPTh7U0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=i6IcT8qaksexcNk5VhLSy/2l/Z/AiLll6pLAtgY0vWLMu1MOHY2HeK1c35pDrDu+p cpIjAeLmI1JLe9K3mRdNA/KTTeJHnKBN24gIILONZC/j9BVv9MflfEvOkZ377i7BUR IaAc1H/LnfPUgphOfkdzNbCuGx6A7Cp5lh/xoH+cJ+/dvEayMQt9y49LTKaE/m40FR WVuCoI91WPB9bIH+gkdYDCEfqI8kQwgdsGIXNuOBoZiIuau9Ogi9JuZEXptnTM6Wjl IgXdi3P69lJJETzMU1yoSjxvsXLU+wfuafMf/rAzC8GNe5Gkmr15bNlrlD1gFJAxuw wkuSu7zDTCbBg== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, jiri@resnulli.us, stephen@networkplumber.org, vinicius.gomes@intel.com, toke@toke.dk, victor@mojatatu.com, bjorn@kernel.org, sashiko-bot@kernel.org X-In-Reply-To: <20261130183825.229246-5-jhs@mojatatu.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