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: <fbb55063-ab03-40a9-80f4-4315d12239ba@t-8ch.de>
Date: Sun, 10 Aug 2025 10:28:44 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Wake Liu <wakel@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, 
	Andy Lutomirski <luto@...nel.org>, Vincenzo Frascino <vincenzo.frascino@....com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vdso: Define NSEC_PER_SEC as 64-bit to prevent overflow

Hi Wake,

On 2025-08-10 10:03:19+0200, Thomas Gleixner wrote:
> On Sat, Aug 09 2025 at 17:49, Wake Liu wrote:
> > long long timespec_sub(struct timespec a, struct timespec b)
> > {
> > long long ret = NSEC_PER_SEC * b.tv_sec + b.tv_nsec;
> >
> > ret -= NSEC_PER_SEC * a.tv_sec + a.tv_nsec;
> > return ret;
> > }

(...)

> And please make that an inline function and put it into a header file in
> the timer selftest directory, and replace _all_ copies of it in the
> various timer tests.

When you create that header file, please add a dedicated definition
of NSEC_PER_SEC to it. The selftests shouldn't be using internal kernel
headers in the first place. Especially not for a single, trivial constant.


Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ