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: <20250610140228.7836d333cea973a8171686fb@linux-foundation.org>
Date: Tue, 10 Jun 2025 14:02:28 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Li Zhijian <lizhijian@...itsu.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, Ying Huang
 <huang.ying.caritas@...il.com>, Balbir Singh <bsingharora@...il.com>, Donet
 Tom <donettom@...ux.ibm.com>, Oscar Salvador <osalvador@...e.de>
Subject: Re: [PATCH] mm/memory-tier: Fix abstract distance calculation
 overflow

On Tue, 10 Jun 2025 14:27:51 +0800 Li Zhijian <lizhijian@...itsu.com> wrote:

> In mt_perf_to_adistance(), the calculation of abstract distance (adist)
> involves multiplying several int values including MEMTIER_ADISTANCE_DRAM.
> ```
> *adist = MEMTIER_ADISTANCE_DRAM *
> 		(perf->read_latency + perf->write_latency) /
> 		(default_dram_perf.read_latency + default_dram_perf.write_latency) *
> 		(default_dram_perf.read_bandwidth + default_dram_perf.write_bandwidth) /
> 		(perf->read_bandwidth + perf->write_bandwidth);
> ```
> Since these values can be large, the multiplication may exceed the maximum
> value of an int (INT_MAX) and overflow (Our platform did), leading to an
> incorrect adist.
> 
> Change MEMTIER_ADISTANCE_DRAM to be a long constant by writing it with the
> 'L' suffix. This prevents the overflow because the multiplication will then
> be done in the long type which has a larger range.

Thanks.  The changelog doesn't describe the userspace-visible effects
of this.  Please always include this info.

I'll assume "minor" and it's been this way for a while so I'll add a
cc:stable to this change and shall queue it for 6.17-rc1, so it will be
backported into 6.17.x and earlier kernels at a later time.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ