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:   Tue, 14 Nov 2017 21:24:03 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     John Stultz <john.stultz@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Stephen Boyd <sboyd@...eaurora.org>,
        "H . Peter Anvin" <hpa@...or.com>,
        Alexander Steffen <Alexander.Steffen@...ineon.com>,
        Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
        Peter Huewe <peterhuewe@....de>,
        Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-integrity@...r.kernel.org
Subject: Re: [PATCH] [RFC] time: Make sure jiffies_to_msecs() preserves
 non-zero time periods

Hi Arnd,

On Tue, Nov 14, 2017 at 9:18 PM, Arnd Bergmann <arnd@...db.de> wrote:
> On Tue, Nov 14, 2017 at 6:36 PM, Geert Uytterhoeven
> <geert@...ux-m68k.org> wrote:
>> For the common cases where 1000 is a multiple of HZ, or HZ is a multiple
>> of 1000, jiffies_to_msecs() never returns zero when passed a non-zero
>> time period.
>>
>> However, if HZ > 1000 and not an integer multiple of 1000 (e.g. 2001),
>> jiffies_to_msecs() may return zero for small non-zero time periods.
>> This may break code that relies on receiving back a non-zero value, e.g.
>> drivers/char/tpm/tpm2-cmd.c:tpm2_do_selftest().
>
> For reference, there are exactly three platforms that allow HZ to be larger
> than 1000, and they specifically use HZ=1024: alpha, itanium and
> mips/decstation.

jiffies_to_msecs(1) = zero if HZ=1024.

>> With the fix above, this becomes a false positive.
>> Nevertheless, it may be a good idea to preinitialize rc anyway, but I
>> have no idea what's the correct value (else I would have sent a patch
>> to do so ;-).
>
> I think changing the while() loop into do{}while() would be appropriate here.

Sounds reasonable.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ