Netdev List
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Cong Wang <xiyou.wangcong@gmail.com>,
	Takamitsu Iwai <takamitz@amazon.co.jp>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	netdev@vger.kernel.org, Kuniyuki Iwashima <kuniyu@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Vladimir Oltean <olteanv@gmail.com>,
	takamitz@amazon.com,
	syzbot+398e1ee4ca2cac05fddb@syzkaller.appspotmail.com
Subject: Re: [PATCH v3 net] net/sched: taprio: enforce minimum value for picos_per_byte
Date: Thu, 31 Jul 2025 12:27:39 -0700	[thread overview]
Message-ID: <8734acw47o.fsf@intel.com> (raw)
In-Reply-To: <aIpbK1q47giH8SRg@pop-os.localdomain>

Cong Wang <xiyou.wangcong@gmail.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

  reply	other threads:[~2025-07-31 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 17:31 [PATCH v3 net] net/sched: taprio: enforce minimum value for picos_per_byte Takamitsu Iwai
2025-07-30 17:49 ` Cong Wang
2025-07-31 19:27   ` Vinicius Costa Gomes [this message]
2025-08-02  0:30 ` patchwork-bot+netdevbpf

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=8734acw47o.fsf@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=syzbot+398e1ee4ca2cac05fddb@syzkaller.appspotmail.com \
    --cc=takamitz@amazon.co.jp \
    --cc=takamitz@amazon.com \
    --cc=xiyou.wangcong@gmail.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