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]
Date:   Thu, 30 Sep 2021 13:04:10 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Iain Hunter <drhunter95@...il.com>
Cc:     lothar.felten@...il.com, iain@...terembedded.co.uk,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        Gwendal Grignou <gwendal@...omium.org>,
        Matt Ranostay <matt.ranostay@...sulko.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Arnd Bergmann <arnd@...db.de>,
        Zeng Tao <prime.zeng@...ilicon.com>, linux-iio@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] workaround regression in ina2xx introduced by
 cb47755725da("time: Prevent undefined behaviour in timespec64_to_ns()")

On Thu, Sep 30, 2021 at 10:10 AM Iain Hunter <drhunter95@...il.com> wrote:
>
> From: Iain Hunter <iain@...terembedded.co.uk>
>
> That change adds an error check to avoid saturation during multiplication
> to calculate nano seconds in timespec64_to_ns().
> In ina2xx_capture_thread() a timespec64 structure is used to calculate
> the delta time until the next sample time. This delta can be negative if
> the next sample time was in the past. In the -1 case timespec64_to_ns()
> now clamps the -1 second value to KTIME_MAX. This essentially puts ina2xx
> thread to sleep forever.
> Proposed patch is to:
> 1 change from timespec64_XXX() to standard raw ktime_XXX() APIs to remove
> non-standard timespec64 calls.
> 2 split the functionality in the loop into two parts:
> - do while loop only does the test to see if the next sample time is in the
> future or in the past and so will be skipped and the sample time
> incremented until it is in the future. This test is done with a simple
> signed comparison as we are only interested in the sign being positive or
> negative.
> - after do while loop we know that next is later than now and so delay is
> positive and ksub_sub() can be used to get the delay which is positive.
>
> Signed-off-by: Iain Hunter <iain@...terembedded.co.uk>
>
> Fixes: cb47755725da("time: Prevent undef$

The changelog text could be improved to more closely follow the
style described in Documentation/process/submitting-patches.rst,
but the important information is here and the changes look good
to me.

Reviewed-by: Arnd Bergmann <arnd@...db.de>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ