Re: [PATCH net v8 4/6] net/sched: netem: validate slot configuration

From: Jamal Hadi Salim

Date: Fri Apr 24 2026 - 16:17:59 EST


() ncalls s


On Fri, Apr 24, 2026 at 11:07 AM Stephen Hemminger
<stephen@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 23 Apr 2026 17:12:15 -0400
> Jamal Hadi Salim <jhs@xxxxxxxxxxxx> wrote:
>
> > > > This is intended and explicitly explained in the cover letter.
> > > Jamal, given the uAPI implication, could you please double check that
> > > the change is fine?
> > >
> >
> > It should be fine; at least iproute2 will never allow the kernel to
> > receive a negative number.
> > Stephen brought up the fact that strtod() could return a -ve number
> > (but at least iproute2 makes sure negative numbers are not carried
> > forward to the kernel).
> >
> > cheers,
> > jamal
>
> Iproute2 blocks negative values kind of by accident.
> The NEXT_IS_NUMBER() macro looks for digit at start of arg.
> To hit this you need to either use raw netlink or change NEXT_IS_NUMBER()
> to NEXT_IS_SIGNED_NUMBER() where slot values are parsed.

For this specific attribute it was intentional:
...
if (get_time64(&slot.dist_jitter, *argv)) { //get_time64 calls
strtod() which could set dist_jitter -ve
explain1("slot jitter");
return -1;
}
if (slot.dist_jitter <= 0) { // we reject -ve values
fprintf(stderr, "Non-positive jitter\n");
return -1;
}

cheers,
jamal