[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFv23Qk3vHFk36deq4NUPsE7gihqa9vdSVM2irnEye-KKLpBMg@mail.gmail.com>
Date: Wed, 30 Jul 2025 16:03:43 +0800
From: AceLan Kao <acelan.kao@...onical.com>
To: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
Cc: "Luck, Tony" <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>, James Morse <james.morse@....com>,
Mauro Carvalho Chehab <mchehab@...nel.org>, Robert Richter <rric@...nel.org>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] EDAC/skx_common: Fix potential negative values in DIMM
size calculation
Zhuo, Qiuxu <qiuxu.zhuo@...el.com> 於 2025年7月30日 週三 下午3:56寫道:
>
> Hi AceLan,
>
> > From: AceLan Kao <acelan@...il.com> On Behalf Of Chia-Lin Kao (AceLan)
> > Sent: Wednesday, July 30, 2025 2:32 PM
> > To: Luck, Tony <tony.luck@...el.com>; Borislav Petkov <bp@...en8.de>; James
> > Morse <james.morse@....com>; Mauro Carvalho Chehab
> > <mchehab@...nel.org>; Robert Richter <rric@...nel.org>; Zhuo, Qiuxu
> > <qiuxu.zhuo@...el.com>; linux-edac@...r.kernel.org; linux-
> > kernel@...r.kernel.org
> > Subject: [PATCH] EDAC/skx_common: Fix potential negative values in DIMM
> > size calculation
> >
> > The skx_get_dimm_attr() function can return a negative error code, which is
> > then assigned to 'ranks', 'rows', or 'cols'.
> >
> > [ 9.344702] EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff)
> > [ 9.344703] EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff)
> > [ 9.344703] EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff)
> > [ 9.344704] ------------[ cut here ]------------
> > [ 9.344705] UBSAN: shift-out-of-bounds in
> > drivers/edac/skx_common.c:453:2
> > [ 9.344707] shift exponent -66 is negative
> >
> > The 3 values, rows, cols, and ranks are all -EINVAL(-22), so this line
> > (1ull << (rows + cols + ranks)
> > would become
> > (1ull << ((-22) + (-22) + (-22))
> > Which leads to shift exponent -66 error
> >
> > Add a check to ensure that 'ranks', 'rows', and 'cols' are not negative before
> > they are used in the size calculation. This prevents the use of invalid values.
> >
> > Fixes: 88a242c98740 ("EDAC, skx_common: Separate common code out from
> > skx_edac")
> > Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@...onical.com>
> >
>
> Thanks for reporting this.
>
> Which CPU did you test it on?
It's an on going project, there is no CPU name on it.
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 52 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 172
On-line CPU(s) list: 0-171
Vendor ID: GenuineIntel
Model name: Genuine Intel(R) 0000
CPU family: 6
Model: 173
Thread(s) per core: 2
Core(s) per socket: 86
Socket(s): 1
Stepping: 1
CPU(s) scaling MHz: 18%
CPU max MHz: 4800.0000
CPU min MHz: 800.0000
BogoMIPS: 3800.00
> Would you mind taking a complete dmesg log with the kernel option
> CONFIG_EDAC_DEBUG=y (your current log showed this option had been enabled)?
Sure, here you are.
I masked the product name in the log.
>
> Thanks!
> -Qiuxu
View attachment "dmesg.log" of type "text/x-log" (213849 bytes)
Powered by blists - more mailing lists