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: <20240807103902.GU39708@noisy.programming.kicks-ass.net>
Date: Wed, 7 Aug 2024 12:39:02 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Arnd Bergmann <arnd@...nel.org>, Ingo Molnar <mingo@...hat.com>,
	Juri Lelli <juri.lelli@...hat.com>, Arnd Bergmann <arnd@...db.de>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	linux-kernel@...r.kernel.org,
	Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH] sched/fair: avoid integer overflow warning for
 fair_server_period_max;

On Wed, Aug 07, 2024 at 12:00:35PM +0200, Vincent Guittot wrote:
> Hi Arnd
> 
> On Wed, 7 Aug 2024 at 10:00, Arnd Bergmann <arnd@...nel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > The clalculation of fair_server_period_max includes an integer overflow:
> >
> > In file included from kernel/sched/build_utility.c:72:
> > kernel/sched/debug.c:341:57: error: integer overflow in expression of type 'long int' results in '-100663296' [-Werror=overflow]
> >   341 | static unsigned long fair_server_period_max = (1 << 22) * NSEC_PER_USEC; /* ~4 seconds */
> >
> > Avoids this by using an unsigned constant to start with.
> 
> Dan sent something similar
> https://lore.kernel.org/lkml/a936b991-e464-4bdf-94ab-08e25d364986@stanley.mountain/

Right, tglx also pointed me at a report for this. Let me go queue Dan's
patch.

> >
> > Fixes: d741f297bcea ("sched/fair: Fair server interface")
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > ---
> >  kernel/sched/debug.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> > index 0148bc65d39c..242e7f264a0b 100644
> > --- a/kernel/sched/debug.c
> > +++ b/kernel/sched/debug.c
> > @@ -338,7 +338,7 @@ enum dl_param {
> >         DL_PERIOD,
> >  };
> >
> > -static unsigned long fair_server_period_max = (1 << 22) * NSEC_PER_USEC; /* ~4 seconds */
> > +static unsigned long fair_server_period_max = (1u << 22) * NSEC_PER_USEC; /* ~4 seconds */
> >  static unsigned long fair_server_period_min = (100) * NSEC_PER_USEC;     /* 100 us */
> >
> >  static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubuf,
> > --
> > 2.39.2
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ