From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Tue, 1 Dec 2026 19:43:24 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D89B11F000C1; Tue, 1 Dec 2026 19:43:23 +0000 (UTC) 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== Subject: Re: [PATCH net-next v15 4/4] net/sched: cake: hash before segmenting and reject an overlong split From: netdev-bot+sashiko@kernel.org To: jhs@mojatatu.com 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 Date: Tue, 01 Dec 2026 19:43:23 +0000 Message-ID: <179615420343.3146.545600846329620433@kernel.org> In-Reply-To: <20261130183825.229246-5-jhs@mojatatu.com> References: <20261130183825.229246-5-jhs@mojatatu.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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 > Signed-off-by: Jamal Hadi Salim [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