From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; dkim=none; arc=none (Message is not ARC signed); dmarc=fail (Used From Domain Record) header.from=toke.dk policy.dmarc=none From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Samuel Moelius Cc: Samuel Moelius , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , "moderated list:CAKE QDISC" , "open list:TC subsystem" , open list In-Reply-To: <20260702000758.297407.e5c888d9d99d.cake-overhead-underflow@trailofbits.com> References: <20260702000758.297407.e5c888d9d99d.cake-overhead-underflow@trailofbits.com> Date: Thu, 02 Jul 2026 11:40:27 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87pl1520hg.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JBU6C5SP2TECBJBLLXWXQC23KA6SZWY3 X-Message-ID-Hash: JBU6C5SP2TECBJBLLXWXQC23KA6SZWY3 X-MailFrom: toke@toke.dk X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Subject: [Cake] Re: [PATCH v3] net/sched: cake: reject overhead values that underflow length List-Id: Cake - FQ_codel the next generation Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Samuel Moelius writes: > CAKE accepts signed overhead values and stores them in an s16, but the > adjusted packet length calculation uses unsigned arithmetic. A negative > effective length can therefore wrap to a large value. > > Such configurations make rate accounting depend on integer wraparound > rather than on the packet size userspace intended to model. A static > netlink lower bound is not enough because packets reaching CAKE can be > smaller than any reasonable manual-overhead allowance. > > Fold the signed overhead adjustment into the existing datapath MPU clamp > so negative adjusted lengths are clamped before link-layer framing > adjustments. > > Fixes: a729b7f0bd5b ("sch_cake: Add overhead compensation support to the = rate shaper") > Assisted-by: Codex:gpt-5.5-cyber-preview > Signed-off-by: Samuel Moelius Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen