+ jffs2-use-unsigned-32-bit-timstamps-consistently.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: fs/jffs2/os-linux.h: use unsigned 32-bit timstamps consistently
has been added to the -mm tree.  Its filename is
     jffs2-use-unsigned-32-bit-timstamps-consistently.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/jffs2-use-unsigned-32-bit-timstamps-consistently.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/jffs2-use-unsigned-32-bit-timstamps-consistently.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Arnd Bergmann <arnd@xxxxxxxx>
Subject: fs/jffs2/os-linux.h: use unsigned 32-bit timstamps consistently

Most users of jffs2 are 32-bit systems that traditionally only support
timestamps using a 32-bit signed time_t, in the range from years 1902 to
2038.  On 64-bit systems, jffs2 however interpreted the same timestamps as
unsigned values, reading back negative times (before 1970) as times
between 2038 and 2106.

Now that Linux supports 64-bit inode timestamps even on 32-bit systems,
let's use the second interpretation everywhere to allow jffs2 to be used
on 32-bit systems beyond 2038 without a fundamental change to the inode
format.

This has a slight risk of regressions, when existing files with timestamps
before 1970 are present in file system images and are now interpreted as
future time stamps.  I considered moving the wraparound point a bit, e.g. 
to 1960, in order to deal with timestamps that ended up on Dec 31, 1969
due to incorrect timezone handling.  However, this would complicate the
implementation unnecessarily, so I went with the simplest possible method
of extending the timestamps.

Writing files with timestamps before 1970 or after 2106 now results in
those times being clamped in the file system.

Link: http://lkml.kernel.org/r/20180713144739.3150217-2-arnd@xxxxxxxx
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/jffs2/os-linux.h |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff -puN fs/jffs2/os-linux.h~jffs2-use-unsigned-32-bit-timstamps-consistently fs/jffs2/os-linux.h
--- a/fs/jffs2/os-linux.h~jffs2-use-unsigned-32-bit-timstamps-consistently
+++ a/fs/jffs2/os-linux.h
@@ -31,13 +31,13 @@ struct kvec;
 #define JFFS2_F_I_GID(f) (i_gid_read(OFNI_EDONI_2SFFJ(f)))
 #define JFFS2_F_I_RDEV(f) (OFNI_EDONI_2SFFJ(f)->i_rdev)
 
-#define ITIME(sec) ((struct timespec64){(int32_t)sec, 0})
-#define JFFS2_NOW() (ktime_get_real_seconds())
-#define I_SEC(tv) ((tv).tv_sec)
-#define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime.tv_sec)
-#define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime.tv_sec)
-#define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime.tv_sec)
-
+#define JFFS2_CLAMP_TIME(t) ((uint32_t)clamp_t(time64_t, (t), 0, U32_MAX))
+#define ITIME(sec) ((struct timespec64){sec, 0})
+#define JFFS2_NOW() JFFS2_CLAMP_TIME(ktime_get_real_seconds())
+#define I_SEC(tv) JFFS2_CLAMP_TIME((tv).tv_sec)
+#define JFFS2_F_I_CTIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_ctime)
+#define JFFS2_F_I_MTIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_mtime)
+#define JFFS2_F_I_ATIME(f) I_SEC(OFNI_EDONI_2SFFJ(f)->i_atime)
 #define sleep_on_spinunlock(wq, s)				\
 	do {							\
 		DECLARE_WAITQUEUE(__wait, current);		\
_

Patches currently in -mm which might be from arnd@xxxxxxxx are

kasan-only-select-slub_debug-with-sysfs=y.patch
jffs2-use-64-bit-intermediate-timestamps.patch
jffs2-use-unsigned-32-bit-timstamps-consistently.patch
firewire-use-64-bit-time_t-based-interfaces.patch
ocfs2-dlmglue-clean-up-timestamp-handling.patch
shmem-use-monotonic-time-for-i_generation.patch
mm-zsmalloc-make-several-functions-and-a-struct-static-fix.patch
procfs-uptime-use-ktime_get_boottime_ts64.patch
crash-print-timestamp-using-time64_t.patch
nilfs2-use-64-bit-superblock-timstamps.patch
hfs-hfsplus-follow-macos-time-behavior.patch
hfs-hfsplus-stop-using-timespec-based-interfaces.patch
reiserfs-use-monotonic-time-for-j_trans_start_time.patch
reiserfs-remove-obsolete-print_time-function.patch
reiserfs-change-j_timestamp-type-to-time64_t.patch
fat-propagate-64-bit-inode-timestamps.patch
adfs-use-timespec64-for-time-conversion.patch
sysvfs-use-ktime_get_real_seconds-for-superblock-stamp.patch
vmcore-hide-vmcoredd_mmap_dumps-for-nommu-builds.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux