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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210201134723.GB41955@lothringen>
Date:   Mon, 1 Feb 2021 14:47:23 +0100
From:   Frederic Weisbecker <frederic@...nel.org>
To:     "Zhou Ti (x2019cwm)" <x2019cwm@...x.ca>
Cc:     "fweisbec@...il.com" <fweisbec@...il.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...nel.org" <mingo@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fix the issue that the tick_nohz_get_sleep_length()
 function could return a negative value

On Wed, Jan 20, 2021 at 11:49:38PM +0000, Zhou Ti (x2019cwm) wrote:
> Fix the issue that the tick_nohz_get_sleep_length() function could return a 
> negative value.
> 
> The variable "dev->next_event" has a small possibility to be smaller than 
> the variable "now" during running, which would result in a negative value 
> of "*delta_next". The variable "next_event" also has a small posibility to 
> be smaller than the variable "now". Both case could lead to a negative 
> return of function tick_nohz_get_sleep_length().

Makes sense, queued, thanks!

> 
> Signed-off-by: Ti Zhou <x2019cwm@...x.ca>
> ---
> --- tip/kernel/time/tick-sched.c.orig	2021-01-20 05:34:25.151325912 -0400
> +++ tip/kernel/time/tick-sched.c	2021-01-20 19:44:28.238538380 -0400
> @@ -1142,6 +1142,9 @@ ktime_t tick_nohz_get_sleep_length(ktime
>  
>  	*delta_next = ktime_sub(dev->next_event, now);
>  
> +	if (unlikely(*delta_next < 0))
> +		*delta_next = 0;
> +
>  	if (!can_stop_idle_tick(cpu, ts))
>  		return *delta_next;
>  
> @@ -1156,6 +1159,9 @@ ktime_t tick_nohz_get_sleep_length(ktime
>  	next_event = min_t(u64, next_event,
>  			   hrtimer_next_event_without(&ts->sched_timer));
>  
> +	if (unlikely(next_event < now))
> +		next_event = now;
> +
>  	return ktime_sub(next_event, now);
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ