[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8734acw47o.fsf@intel.com>
Date: Thu, 31 Jul 2025 12:27:39 -0700
From: Vinicius Costa Gomes <vinicius.gomes@...el.com>
To: Cong Wang <xiyou.wangcong@...il.com>, Takamitsu Iwai
<takamitz@...zon.co.jp>
Cc: Jamal Hadi Salim <jhs@...atatu.com>, Jiri Pirko <jiri@...nulli.us>,
netdev@...r.kernel.org, Kuniyuki Iwashima <kuniyu@...gle.com>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>, Vladimir Oltean <olteanv@...il.com>,
takamitz@...zon.com, syzbot+398e1ee4ca2cac05fddb@...kaller.appspotmail.com
Subject: Re: [PATCH v3 net] net/sched: taprio: enforce minimum value for
picos_per_byte
Cong Wang <xiyou.wangcong@...il.com> writes:
> On Tue, Jul 29, 2025 at 02:31:49AM +0900, Takamitsu Iwai wrote:
>> Syzbot reported a WARNING in taprio_get_start_time().
>>
>> When link speed is 470,589 or greater, q->picos_per_byte becomes too
>> small, causing length_to_duration(q, ETH_ZLEN) to return zero.
>>
>> This zero value leads to validation failures in fill_sched_entry() and
>> parse_taprio_schedule(), allowing arbitrary values to be assigned to
>> entry->interval and cycle_time. As a result, sched->cycle can become zero.
>>
>> Since SPEED_800000 is the largest defined speed in
>> include/uapi/linux/ethtool.h, this issue can occur in realistic scenarios.
>>
>> To ensure length_to_duration() returns a non-zero value for minimum-sized
>> Ethernet frames (ETH_ZLEN = 60), picos_per_byte must be at least 17
>> (60 * 17 > PSEC_PER_NSEC which is 1000).
>>
>> This patch enforces a minimum value of 17 for picos_per_byte when the
>> calculated value would be lower, and adds a warning message to inform
>> users that scheduling accuracy may be affected at very high link speeds.
>
> Is it possible to reproduce this with a selftest? If so, please consider
> adding one.
Good idea. From a quick look, it seems that netdevsim doesn't have
support for .{get,set}_link_ksettings(), so I guess it would be
something for later.
Cheers,
--
Vinicius
Powered by blists - more mailing lists