From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Victor Nogueira <victor@mojatatu.com>,
vega@nebusec.ai, stable@vger.kernel.org, toke@redhat.com,
chia-yu.chang@nokia-bell-labs.com, subramanian.vijay@gmail.com,
petrm@nvidia.com
Subject: Re: [PATCH net v2 8/8] net/sched: ets: clamp quantum in parse and fallback paths
Date: Sun, 30 Aug 2026 14:59:35 -0400 [thread overview]
Message-ID: <CAM0EoMk6t2FB_3ewLHrh8rqnaj_ecO2L2w7BA0xRUXGJSoqJeA@mail.gmail.com> (raw)
In-Reply-To: <20260830110317.3357a4ea@kernel.org>
On Sun, Aug 30, 2026 at 2:03 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Sat, 29 Aug 2026 04:12:29 -0400 Jamal Hadi Salim wrote:
> > ets_qdisc_change() falls back to psched_mtu() with no floor for bands
> > without an explicit quantum. With a crafted size table qdisc_pkt_len
> > reaches ~2 GiB, so a zero psched_mtu on a headerless device makes the
> > deficit-refill loop spin under the qdisc lock.
> >
> > Move the floor into ets_quantum_parse() so explicitly configured quanta
> > are also clamped to [256, 1<<20], not just the fallback path.
> >
> > Conditions to recreate the bug:
> > CONFIG_NET_SCH_ETS=y. Requires CAP_NET_ADMIN (namespace-local via
> > unshare -Urn suffices).
> >
> > tc qdisc add dev dummy0 root ets bands 3 strict 2 quanta 1 1
> >
> > Fixes: dcc68b4d8084 ("net: sch_ets: Add a new Qdisc")
> > Reported-by: vega@nebusec.ai
> > Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
> > Tested-by: Victor Nogueira <victor@mojatatu.com>
> > Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > Cc: stable@vger.kernel.org
> > ---
> > net/sched/sch_ets.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c
> > index 25fcf4079fec..6cc902a03838 100644
> > --- a/net/sched/sch_ets.c
> > +++ b/net/sched/sch_ets.c
> > @@ -83,11 +83,7 @@ static int ets_quantum_parse(struct Qdisc *sch, const struct nlattr *attr,
> > unsigned int *quantum,
> > struct netlink_ext_ack *extack)
> > {
> > - *quantum = nla_get_u32(attr);
> > - if (!*quantum) {
> > - NL_SET_ERR_MSG(extack, "ETS quantum cannot be zero");
> > - return -EINVAL;
> > - }
> > + *quantum = clamp_t(u32, nla_get_u32(attr), 256, 1 << 20);
> > return 0;
> > }
> >
> > @@ -632,11 +628,13 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
> > return err;
> > }
> > /* If there are more bands than strict + quanta provided, the remaining
> > - * ones are ETS with quantum of MTU. Initialize the missing values here.
> > + * ones are ETS with quantum of max(MTU, 256). Initialize the missing
> > + * values here.
> > */
> > for (i = nstrict; i < nbands; i++) {
> > if (!quanta[i])
> > - quanta[i] = psched_mtu(qdisc_dev(sch));
> > + quanta[i] = clamp_t(u32, (u32)psched_mtu(qdisc_dev(sch)),
> > + 256, 1 << 20);
> > }
> >
> > /* Before commit, make sure we can allocate all new qdiscs */
>
> Does this run afoul of one of the tdc cases?
>
> # not ok 39 41f5 - ETS offload where the sum of quanta wraps u32
> # Could not match regex pattern. Verify command output:
> # qdisc ets 8004: root refcnt 5 offloaded bands 3 quanta 1048576 256 256 priomap 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
>
> https://github.com/p4tc-dev/tc-executor/blob/storage-dbg/artifacts/799938/1-tdc-sh/stdout
Yikes. I will resend with this fixed.
cheers.
jamal
next prev parent reply other threads:[~2026-08-30 18:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <all>
[not found] ` <20260829081229.81708-1-jhs@mojatatu.com>
[not found] ` <20260829081229.81708-9-jhs@mojatatu.com>
2026-08-30 18:03 ` [PATCH net v2 8/8] net/sched: ets: clamp quantum in parse and fallback paths Jakub Kicinski
2026-08-30 18:59 ` Jamal Hadi Salim [this message]
2026-09-01 21:36 ` Jamal Hadi Salim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAM0EoMk6t2FB_3ewLHrh8rqnaj_ecO2L2w7BA0xRUXGJSoqJeA@mail.gmail.com \
--to=jhs@mojatatu.com \
--cc=chia-yu.chang@nokia-bell-labs.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=stable@vger.kernel.org \
--cc=subramanian.vijay@gmail.com \
--cc=toke@redhat.com \
--cc=vega@nebusec.ai \
--cc=victor@mojatatu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox