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: <CANDhNCo-BWqpX1aWi8-q1RaAA_4KigUPcaEML6yCb2EksAX=vA@mail.gmail.com>
Date: Thu, 12 Sep 2024 13:35:41 -0700
From: John Stultz <jstultz@...gle.com>
To: Jeff Layton <jlayton@...nel.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, 
	Thomas Gleixner <tglx@...utronix.de>, Stephen Boyd <sboyd@...nel.org>, Arnd Bergmann <arnd@...nel.org>, 
	Vadim Fedorenko <vadim.fedorenko@...ux.dev>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org, kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH v2] timekeeping: move multigrain timestamp floor handling
 into timekeeper

On Thu, Sep 12, 2024 at 1:33 PM John Stultz <jstultz@...gle.com> wrote:
>
> On Thu, Sep 12, 2024 at 1:18 PM Jeff Layton <jlayton@...nel.org> wrote:
> > On Thu, 2024-09-12 at 13:11 -0700, John Stultz wrote:
> > > On Thu, Sep 12, 2024 at 11:02 AM Jeff Layton <jlayton@...nel.org> wrote:
> > > But instead, it seems like if something has happened since the cookie
> > > value was saved (another cpu getting a fine grained timestamp), your
> > > ktime_get_real_ts64_mg() will fall back to returning the same coarse
> > > grained time saved to the cookie, as if no time had past?
> > >
> > > It seems like that could cause problems:
> > >
> > > cpu1                                     cpu2
> > > --------------------------------------------------------------------------
> > >                                          t2a = ktime_get_coarse_real_ts64_mg
> > > t1a = ktime_get_coarse_real_ts64_mg()
> > > t1b = ktime_get_real_ts64_mg(t1a)
> > >
> > >                                          t2b = ktime_get_real_ts64_mg(t2a)
> > >
> > > Where t2b will seem to be before t1b, even though it happened afterwards.
> > >
> >
> > Ahh no, the subtle thing about atomic64_try_cmpxchg is that it
> > overwrites "old" with the value that was currently there in the event
> > that the cmp fails.
>
> Ah, ok. Thank you for the explanation there!
>
> > So, the try_cmpxchg there will either swap the new value into place, or
> > if it was updated in the meantime, "old" will now refer to the value
> > that's currently in the floor word. Either is fine in this case, so we
> > don't need to retry anything.
>
>
> Though if cpu2 then made another call to
> ktime_get_coarse_real_ts64_mg(), the value returned there will be the
> same as t1b? and would be before t2b?

Oh, no. Apologies again, as I see  t2b would be the same as t1b as well. Ok.
-john

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ