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:	Fri, 12 Feb 2016 01:45:49 -0800
From:	Deepa Dinamani <deepa.kernel@...il.com>
To:	linux-fsdevel@...r.kernel.org, y2038@...ts.linaro.org
Cc:	Arnd Bergmann <arnd@...db.de>, Dave Chinner <david@...morbit.com>,
	"Theodore Ts'o" <tytso@....edu>, linux-kernel@...r.kernel.org
Subject: [RFC v2b 5/5] fs: xfs: change inode times to use vfs_time data type

This is in preparation for changing VFS inode timestamps to
use 64 bit time.
The VFS inode timestamps are not y2038 safe as they use
struct timespec. These will be changed to use struct timespec64
instead and that is y2038 safe.
But, since the above data type conversion will break the
end file systems, use vfs_time functions to access inode times.

current_fs_time() will change along with vfs timestamp data
type changes.

xfs_vn_update_time() is a .update callback for inode operations
and this needs to change along with vfs inode times.

Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
---
 fs/xfs/xfs_inode.c       |  2 +-
 fs/xfs/xfs_trans_inode.c | 24 ++++++++++++++----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index ceba1a8..fc20e65 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -831,7 +831,7 @@ xfs_ialloc(
 	ip->i_d.di_nextents = 0;
 	ASSERT(ip->i_d.di_nblocks == 0);
 
-	tv = current_fs_time(mp->m_super);
+	tv = vfs_time_to_timespec(current_fs_time(mp->m_super));
 	ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
 	ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
 	ip->i_d.di_atime = ip->i_d.di_mtime;
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index b97f1df..e469e6a 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -68,24 +68,28 @@ xfs_trans_ichgtime(
 	int			flags)
 {
 	struct inode		*inode = VFS_I(ip);
-	struct timespec		tv;
+	struct timespec		now;
+	struct timespec     ts;
 
 	ASSERT(tp);
 	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
-	tv = current_fs_time(inode->i_sb);
+	now = vfs_time_to_timespec(current_fs_time(inode->i_sb));
 
+	ts = vfs_time_to_timespec(inode->i_mtime);
 	if ((flags & XFS_ICHGTIME_MOD) &&
-	    !timespec_equal(&inode->i_mtime, &tv)) {
-		inode->i_mtime = tv;
-		ip->i_d.di_mtime.t_sec = tv.tv_sec;
-		ip->i_d.di_mtime.t_nsec = tv.tv_nsec;
+	    !timespec_equal(&ts, &now)) {
+		inode->i_mtime = timespec_to_vfs_time(now);
+		ip->i_d.di_mtime.t_sec = now.tv_sec;
+		ip->i_d.di_mtime.t_nsec = now.tv_nsec;
 	}
+
+	ts = vfs_time_to_timespec(inode->i_ctime);
 	if ((flags & XFS_ICHGTIME_CHG) &&
-	    !timespec_equal(&inode->i_ctime, &tv)) {
-		inode->i_ctime = tv;
-		ip->i_d.di_ctime.t_sec = tv.tv_sec;
-		ip->i_d.di_ctime.t_nsec = tv.tv_nsec;
+	    !timespec_equal(&ts, &now)) {
+		inode->i_ctime = timespec_to_vfs_time(now);
+		ip->i_d.di_ctime.t_sec = now.tv_sec;
+		ip->i_d.di_ctime.t_nsec = now.tv_nsec;
 	}
 }
 
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ