From: Arnd Bergmann <arnd@arndb.de>
To: outreachy-kernel@googlegroups.com
Cc: "Ksenija Stanojević" <ksenija.stanojevic@gmail.com>,
y2038@lists.linaro.org
Subject: Re: [Outreachy kernel] Re: [Y2038] [PATCH 1/5] fs: nfsd: Replace time_t with u32 in boot_time
Date: Wed, 04 Nov 2015 15:44:12 +0100 [thread overview]
Message-ID: <8546847.yByvRe1hVG@wuerfel> (raw)
In-Reply-To: <CAL7P5jLv9Ba0t+qKRe_0Nx3SrQZQbBgmvxYuK6t2z_7d=4HiAw@mail.gmail.com>
On Tuesday 03 November 2015 18:17:48 Ksenija Stanojević wrote:
> On Tue, Nov 3, 2015 at 4:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Tuesday 27 October 2015 09:08:35 Ksenija Stanojevic wrote:
> >> Replace time_t type and get_seconds function which are not y2038 safe on
> >> 32-bit systems. Function ktime_get_seconds use monotonic instead of real
> >> time and therefore will not cause overflow.
> >>
> >> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
> >
> > I don't think using monotonic time is safe here:
>
> I was under the impression that comment:
>
> * We're assuming the clid was not given out from a boot
> * precisely 2^32 (about 136 years) before this one. That seems
> * a safe assumption:
>
> is implying that monotonic time is used (should be used).
You almost convinced me, and I just spent an hour trying to
understand what is actually going on. I think I've got it now,
and this is what happens:
The NFS client sends a SETCLIENTID request to the server, which
generates the clientid using boot_time and a unique (for this instance)
number, together these two make up a 'clientid_t'. This is sent
back to the client in the response, and it gets encoded as part
of nfsd4_encode_setclientid() in the line
p = xdr_encode_opaque_fixed(p, &scd->se_clientid, 8);
The reason this does not show up when you grep for cl_boot is that
xdr_encode_opaque_fixed just takes the number as set of eight bytes
that are not meaningful to the client. The client then sends back
the number to the server on other requests, e.g. in nfsd4_sessionid,
and the server checks cl_boot to ensure that is the same number
as boot_time, and this way it can tell whether the server has been
rebooted while keeping the client session running.
If you use monotonic times for generating boot_time, that means
it could be the same after a reboot because the time to get
from poweron to starting the NFS server is relatively deterministic.
This however defeats the purpose of comparing the boot times.
So you have to use real time here, but it is safe to truncate the
time to the low 32 bits because the number is never used as the
actual time, just as a token that is required to be unique
for each time the server gets booted.
Arnd
next prev parent reply other threads:[~2015-11-04 14:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 16:07 [PATCH 0/5] fs: nfsd: Remove time_t Ksenija Stanojevic
2015-10-27 16:08 ` [PATCH 1/5] fs: nfsd: Replace time_t with u32 in boot_time Ksenija Stanojevic
2015-11-04 0:04 ` [Y2038] " Arnd Bergmann
2015-11-04 2:17 ` Ksenija Stanojević
2015-11-04 14:44 ` Arnd Bergmann [this message]
2015-10-27 16:09 ` [PATCH 2/5] fs: nfsd: Replace time_t with u32 in nfsd4_lease Ksenija Stanojevic
2015-11-04 0:14 ` [Y2038] " Arnd Bergmann
2015-11-10 4:37 ` Ksenija Stanojević
2015-11-10 10:01 ` Arnd Bergmann
2015-10-27 16:10 ` [PATCH 3/5] fs: nfsd: Replace time_t with u32 in nfsd4_grace Ksenija Stanojevic
2015-11-04 0:17 ` [Y2038] " Arnd Bergmann
2015-11-04 2:27 ` Ksenija Stanojević
2015-11-04 13:57 ` Arnd Bergmann
2015-10-27 16:11 ` [PATCH 4/5] fs: nfsd: Replace time_t with u32 dl_time Ksenija Stanojevic
2015-11-04 0:20 ` [Y2038] " Arnd Bergmann
2015-10-27 16:12 ` [PATCH 5/5] fs: nfsd: Replace time_t with u32 oo_time Ksenija Stanojevic
2015-11-04 0:21 ` [Y2038] " Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8546847.yByvRe1hVG@wuerfel \
--to=arnd@arndb.de \
--cc=ksenija.stanojevic@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.