All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Files dated before 1970
Date: Fri, 19 Jun 2020 19:16:11 -0700	[thread overview]
Message-ID: <20200620021611.GD8681@bombadil.infradead.org> (raw)


Hi Deepa,

Your commit 95582b008388 ("vfs: change inode times to use struct
timespec64") changed the behaviour of some filesystems with regards to
files from before 1970.  Specifically, this line from JFS, unchanged
since before 2.6.12:

fs/jfs/jfs_imap.c:3065: ip->i_atime.tv_sec = le32_to_cpu(dip->di_atime.tv_sec);

le32_to_cpu() returns a u32.  Before your patch, the u32 was assigned
to an s32, so a file with a date stamp of 1968 would show up that way.
After your patch, the u32 is zero-extended to an s64, so a file from
1968 now appears to be from 2104.

Obviously there aren't a lot of files around from before 1970, so it's
not surprising that nobody's noticed yet.  But I don't think this was
an intended change.

I see a similar problem in bfs, efs & qnx4.  Other filesystems might also
have the same problem, but I haven't done an intensive investigation.
This started as a bit of banter, and I inadvertently noticed this bug,
so I felt I had a moral imperative to report it.

Thanks for all the work you've done on the y2038 problem; it's really
important.  It might even be the right thing to do to start treating
32-bit filesystem seconds as being unsigned.  But from the commit message,
that didn't seem to be the intended effect.

The fix is simple; cast the result to (int) like XFS and ext2 do.
But someone needs to go through all the filesystems with care.  And it'd
be great if someone wrote an xfstest for handling files from 1968.

             reply	other threads:[~2020-06-20  2:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20  2:16 Matthew Wilcox [this message]
2020-06-20  8:59 ` Files dated before 1970 Arnd Bergmann
2020-06-20 16:15   ` Matthew Wilcox
2020-06-21 23:38     ` Deepa Dinamani
2020-06-21 23:36   ` Dave Chinner

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=20200620021611.GD8681@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.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.