summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-11-11 22:43:33 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-11 22:46:09 -0800
commitac62743e380c90255fbca6b76d899c3b7cf70877 (patch)
tree7ae68f085e65edfd67e57d6add33520aaa68b571 /pkg/sentry/fsimpl
parent447452fb1a053607707e547033952aa3200d38f1 (diff)
Read fsimpl/tmpfs timestamps atomically.
PiperOrigin-RevId: 341982672
Diffstat (limited to 'pkg/sentry/fsimpl')
-rw-r--r--pkg/sentry/fsimpl/tmpfs/tmpfs.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs.go b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
index 85a3dfe20..c5a131d5d 100644
--- a/pkg/sentry/fsimpl/tmpfs/tmpfs.go
+++ b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
@@ -478,9 +478,9 @@ func (i *inode) statTo(stat *linux.Statx) {
stat.GID = atomic.LoadUint32(&i.gid)
stat.Mode = uint16(atomic.LoadUint32(&i.mode))
stat.Ino = i.ino
- stat.Atime = linux.NsecToStatxTimestamp(i.atime)
- stat.Ctime = linux.NsecToStatxTimestamp(i.ctime)
- stat.Mtime = linux.NsecToStatxTimestamp(i.mtime)
+ stat.Atime = linux.NsecToStatxTimestamp(atomic.LoadInt64(&i.atime))
+ stat.Ctime = linux.NsecToStatxTimestamp(atomic.LoadInt64(&i.ctime))
+ stat.Mtime = linux.NsecToStatxTimestamp(atomic.LoadInt64(&i.mtime))
stat.DevMajor = linux.UNNAMED_MAJOR
stat.DevMinor = i.fs.devMinor
switch impl := i.impl.(type) {