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] [day] [month] [year] [list]
Message-Id: <20260128101339.658d522c69bb4466218ee437@linux-foundation.org>
Date: Wed, 28 Jan 2026 10:13:39 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Petr Mladek <pmladek@...e.com>
Cc: shengminghu512 <shengminghu512@...com>, tglx <tglx@...utronix.de>, mingo
 <mingo@...nel.org>, broonie <broonie@...nel.org>, linux-kernel
 <linux-kernel@...r.kernel.org>, "hu.shengming" <hu.shengming@....com.cn>,
 "zhang.run" <zhang.run@....com.cn>
Subject: Re: [PATCH] watchdog/softlockup: Fix sample ring index wrap in
 need_counting_irqs()

On Wed, 28 Jan 2026 18:52:11 +0100 Petr Mladek <pmladek@...e.com> wrote:

> On Mon 2026-01-19 21:59:05, shengminghu512 wrote:
> > From: Shengming Hu <hu.shengming@....com.cn>
> > 
> > cpustat_tail indexes cpustat_util[], which is a NUM_SAMPLE_PERIODS-sized
> > ring buffer. need_counting_irqs() currently wraps the index using
> > NUM_HARDIRQ_REPORT, which only happens to match NUM_SAMPLE_PERIODS.
> > 
> > Use NUM_SAMPLE_PERIODS for the wrap to keep the ring math correct even if
> > the NUM_HARDIRQ_REPORT or  NUM_SAMPLE_PERIODS changes.
> > 
> > ---
> >  kernel/watchdog.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> > index b4d5fbdb9..7d675781b 100644
> > --- a/kernel/watchdog.c
> > +++ b/kernel/watchdog.c
> > @@ -550,7 +550,7 @@ static bool need_counting_irqs(void)
> >  	u8 util;
> >  	int tail = __this_cpu_read(cpustat_tail);
> >  
> > -	tail = (tail + NUM_HARDIRQ_REPORT - 1) % NUM_HARDIRQ_REPORT;
> > +	tail = (tail + NUM_SAMPLE_PERIODS - 1) % NUM_SAMPLE_PERIODS;
> >  	util = __this_cpu_read(cpustat_util[tail][STATS_HARDIRQ]);
> >  	return util > HARDIRQ_PERCENT_THRESH;
> 
> Great catch! It makes perfect sense.
> 
> The NUM_HARDIRQ_REPORT is used for another array (irq_counts_sorted[])
> with the most frequent IRQs. This code was added with the same commit
> which added the other array. It would explain the mistake.
> 
> Reviewed-by: Petr Mladek <pmladek@...e.com>

Fixes: e9a9292e2368 ("watchdog/softlockup: Report the most frequent
interrupts"), yes?

What are the runtime effects of this?  "most frequent interrupts" data
is messed up?

I'm assuming we want to fix earlier kernels, so cc:stable?

> Andrew, I assume that you would take it...

Sure, I can queue it.  e9a9292e2368 was merged by tglx so he might want
to take it - if so I'll drop the mm.git copy if/when this appears in
linux-next.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ