summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2020-11-13 00:46:16 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-13 00:48:22 -0800
commitcc1b20590cf4505e04b8c221d1d950e45110f5f0 (patch)
treedbd84ba5c15cdaf5a83edd6486b9ac8393eb1458 /pkg/sentry
parent8e6963491c7bc9b98fc7bcff5024089726a9c204 (diff)
fs/tmpfs: use atomic operations to access inode.mode
PiperOrigin-RevId: 342214859
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fsimpl/tmpfs/tmpfs.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs.go b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
index c5a131d5d..0c9c639d3 100644
--- a/pkg/sentry/fsimpl/tmpfs/tmpfs.go
+++ b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
@@ -631,7 +631,8 @@ func (i *inode) direntType() uint8 {
}
func (i *inode) isDir() bool {
- return linux.FileMode(i.mode).FileType() == linux.S_IFDIR
+ mode := linux.FileMode(atomic.LoadUint32(&i.mode))
+ return mode.FileType() == linux.S_IFDIR
}
func (i *inode) touchAtime(mnt *vfs.Mount) {