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: <aKw-yTq3jMeku5yG@localhost>
Date: Mon, 25 Aug 2025 12:45:29 +0200
From: Miroslav Lichvar <mlichvar@...hat.com>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Cc: Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
	jstultz@...gle.com
Subject: Re: CLOCK_AUX stepping

On Mon, Aug 25, 2025 at 12:22:34PM +0200, Thomas Weißschuh wrote:
> For high offsets we are stuck looping in __iter_div_u64().
> As far as I know, doing regular divisions in the timekeeping hot patch are
> problematic on some architectures, so instead of storing the offset as a
> single ktime_t, we might need to switch to 'struct timespec64' and do the
> division on clock adjustments.
> 
> Can you try the following patch for now?

The patch fixes the problem for me. Thanks.

> diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c
> index 8ba8b0d8a387..8190e9dc6569 100644
> --- a/kernel/time/vsyscall.c
> +++ b/kernel/time/vsyscall.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <linux/hrtimer.h>
> +#include <linux/math64.h>
>  #include <linux/timekeeper_internal.h>
>  #include <vdso/datapage.h>
>  #include <vdso/helpers.h>
> @@ -143,6 +144,7 @@ void vdso_time_update_aux(struct timekeeper *tk)
>  	struct vdso_timestamp *vdso_ts;
>  	struct vdso_clock *vc;
>  	s32 clock_mode;
> +	u32 nsec32;
>  	u64 nsec;
>  
>  	vc = &vdata->aux_clock_data[tk->id - TIMEKEEPER_AUX_FIRST];
> @@ -163,7 +165,8 @@ void vdso_time_update_aux(struct timekeeper *tk)
>  
>  		nsec = tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
>  		nsec += tk->offs_aux;
> -		vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &nsec);
> +		vdso_ts->sec += div_u64_rem(nsec, NSEC_PER_SEC, &nsec32);
> +		nsec = nsec32;
>  		nsec = nsec << tk->tkr_mono.shift;
>  		vdso_ts->nsec = nsec;
>  	}
> 
> 
> 
> Thomas
> 

-- 
Miroslav Lichvar


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ