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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0B2NSdVf+qOrg=ds7_mhJqBTCqznALQpNQuQ-fNDR+wg@mail.gmail.com>
Date:   Fri, 14 Jun 2019 13:18:14 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     "Jason A. Donenfeld" <Jason@...c4.com>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Arnd Bergmann <arnd@...db.de>,
        Clemens Ladisch <clemens@...isch.de>,
        Waiman Long <longman@...hat.com>,
        Sultan Alsawaf <sultan@...neltoast.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:     linux-tip-commits@...r.kernel.org
Subject: Re: [tip:timers/urgent] timekeeping: Repair ktime_get_coarse*() granularity

On Fri, Jun 14, 2019 at 11:55 AM tip-bot for Thomas Gleixner
<tipbot@...or.com> wrote:
>
> Commit-ID:  e3ff9c3678b4d80e22d2557b68726174578eaf52
> Gitweb:     https://git.kernel.org/tip/e3ff9c3678b4d80e22d2557b68726174578eaf52
> Author:     Thomas Gleixner <tglx@...utronix.de>
> AuthorDate: Thu, 13 Jun 2019 21:40:45 +0200
> Committer:  Thomas Gleixner <tglx@...utronix.de>
> CommitDate: Fri, 14 Jun 2019 11:51:44 +0200
>
> timekeeping: Repair ktime_get_coarse*() granularity
>
> Jason reported that the coarse ktime based time getters advance only once
> per second and not once per tick as advertised.
>
> The code reads only the monotonic base time, which advances once per
> second. The nanoseconds are accumulated on every tick in xtime_nsec up to
> a second and the regular time getters take this nanoseconds offset into
> account, but the ktime_get_coarse*() implementation fails to do so.
>
> Add the accumulated xtime_nsec value to the monotonic base time to get the
> proper per tick advancing coarse tinme.

Acked-by: Arnd Bergmann <arnd@...db.de> (too late, I know)

I checked what code is actually affected. Fortunately there are only
a very small number of callers that I could find:

arch/powerpc/xmon/xmon.c:        ktime_get_coarse_boottime_ts64(&uptime);
drivers/iio/industrialio-core.c:        return
ktime_to_ns(ktime_get_coarse_real());
drivers/power/supply/ab8500_fg.c:    time64_t now =
ktime_get_boottime_seconds();
drivers/net/wireless/intel/ipw2x00/ipw2100.c:    time64_t now =
ktime_get_boottime_seconds();

Only two of these even read the sub-second portion, and the
iio file only calls this function if CLOCK_REALTIME_COARSE
was passed from user space.

I don't think any harm was done so far by this bug, so it's not surprising
we never noticed.

         Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ