Commit 805f02e8 authored by Yu Kuai's avatar Yu Kuai Committed by Cheng Jian
Browse files

fs/xfs: fix time overflow



hulk inclusion
category: bugfix
bugzilla: 50526
CVE: NA
---------------------------

Inode atime/mtime is 64-bit, however xfs ondisk atime/mtime is 32-bit(
supported range is from Dec 13 20:45:52 UTC 1901 to Jan 19 03:14:07 UTC
2038). Thus if in-memory atime/mtime overflow, after umount and mount,
atime/mtime will be wrong.

In order to fix it, truncate atime/ctime/mtime in xfs_vn_setattr().

This problem was fixed in commit 22b13969 ("fs: Fill in max and min
timestamps in superblock") from mainline, which relied on commit
50e17c00 ("vfs: Add timestamp_truncate() api") and commit 188d20bc
("vfs: Add file timestamp range support"). However, kabi will be broken
if we backport these patches, thus we do local adaptation for xfs
instead.

Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
parent b182a791
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment