lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230712061122.GW41919@unreal>
Date: Wed, 12 Jul 2023 09:11:22 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Florian Kauer <florian.kauer@...utronix.de>,
	Tony Nguyen <anthony.l.nguyen@...el.com>, davem@...emloft.net,
	pabeni@...hat.com, edumazet@...gle.com, netdev@...r.kernel.org,
	kurt@...utronix.de, vinicius.gomes@...el.com,
	muhammad.husaini.zulkifli@...el.com, tee.min.tan@...ux.intel.com,
	aravindhan.gunasekaran@...el.com, sasha.neftin@...el.com,
	Naama Meir <naamax.meir@...ux.intel.com>
Subject: Re: [PATCH net 5/6] igc: Fix launchtime before start of cycle

On Tue, Jul 11, 2023 at 05:54:54PM -0700, Jakub Kicinski wrote:
> On Tue, 11 Jul 2023 13:12:33 +0300 Leon Romanovsky wrote:
> > > If I understand correctly, ktime_sub_ns(txtime, baset_est) will only return
> > > something larger than s32 max if cycle_time is larger than s32 max and if that
> > > is the case everything will be broken anyway since the corresponding hardware
> > > register only holds 30 bits.  
> > 
> > I suggest you to use proper variable types, what about the following
> > snippet?
> > 
> > ktime_t launchtime;
> > 
> > launchtime = ktime_sub_ns(txtime, baset_est);
> > WARN_ON(upper_32_bits(launchtime));
> > div_s64_rem(launchtime, cycle_time, &launchtime);
> > 
> > return cpu_to_le32(lower_32_bits(launchtime));
> 
> That needs to be coupled with some control path checks on cycle_time?

I think so, as I didn't find any checks which protect from overflow.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ