summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-19 02:03:15 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-19 02:03:15 +0000
commit91407007c0df4813d06e22df1a43d2b0e413d938 (patch)
treed8b94f92ad434426c8162e4e1b453b6bed15bfa9 /pkg/sentry
parentd1ed73fafd02d394090850cac586d3ef4bf7b7ee (diff)
parent9da77d00fa682ff504c7ff549985f78b0574c79b (diff)
Merge release-20200810.0-56-g9da77d00f (automated)
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fsimpl/gofer/time.go2
-rw-r--r--pkg/sentry/platform/ring0/defs_impl_arm64.go4
-rw-r--r--pkg/sentry/vfs/mount.go11
3 files changed, 9 insertions, 8 deletions
diff --git a/pkg/sentry/fsimpl/gofer/time.go b/pkg/sentry/fsimpl/gofer/time.go
index 2cb8191b9..e59d07e90 100644
--- a/pkg/sentry/fsimpl/gofer/time.go
+++ b/pkg/sentry/fsimpl/gofer/time.go
@@ -38,7 +38,7 @@ func statxTimestampFromDentry(ns int64) linux.StatxTimestamp {
// Preconditions: d.cachedMetadataAuthoritative() == true.
func (d *dentry) touchAtime(mnt *vfs.Mount) {
- if mnt.Flags.NoATime {
+ if mnt.Flags.NoATime || mnt.ReadOnly() {
return
}
if err := mnt.CheckBeginWrite(); err != nil {
diff --git a/pkg/sentry/platform/ring0/defs_impl_arm64.go b/pkg/sentry/platform/ring0/defs_impl_arm64.go
index eba2eac30..424b66f76 100644
--- a/pkg/sentry/platform/ring0/defs_impl_arm64.go
+++ b/pkg/sentry/platform/ring0/defs_impl_arm64.go
@@ -3,11 +3,11 @@ package ring0
import (
"gvisor.dev/gvisor/pkg/sentry/arch"
"gvisor.dev/gvisor/pkg/sentry/platform/ring0/pagetables"
- "io"
- "reflect"
"fmt"
"gvisor.dev/gvisor/pkg/usermem"
+ "io"
+ "reflect"
)
// Useful bits.
diff --git a/pkg/sentry/vfs/mount.go b/pkg/sentry/vfs/mount.go
index d1d29d0cd..67dfba986 100644
--- a/pkg/sentry/vfs/mount.go
+++ b/pkg/sentry/vfs/mount.go
@@ -114,7 +114,7 @@ func (mnt *Mount) Options() MountOptions {
defer mnt.vfs.mountMu.Unlock()
return MountOptions{
Flags: mnt.Flags,
- ReadOnly: mnt.readOnly(),
+ ReadOnly: mnt.ReadOnly(),
}
}
@@ -688,7 +688,8 @@ func (mnt *Mount) setReadOnlyLocked(ro bool) error {
return nil
}
-func (mnt *Mount) readOnly() bool {
+// ReadOnly returns true if mount is readonly.
+func (mnt *Mount) ReadOnly() bool {
return atomic.LoadInt64(&mnt.writers) < 0
}
@@ -756,7 +757,7 @@ func (vfs *VirtualFilesystem) GenerateProcMounts(ctx context.Context, taskRootDi
}
opts := "rw"
- if mnt.readOnly() {
+ if mnt.ReadOnly() {
opts = "ro"
}
if mnt.Flags.NoATime {
@@ -844,7 +845,7 @@ func (vfs *VirtualFilesystem) GenerateProcMountInfo(ctx context.Context, taskRoo
// (6) Mount options.
opts := "rw"
- if mnt.readOnly() {
+ if mnt.ReadOnly() {
opts = "ro"
}
if mnt.Flags.NoATime {
@@ -883,7 +884,7 @@ func superBlockOpts(mountPath string, mnt *Mount) string {
// gVisor doesn't (yet) have a concept of super block options, so we
// use the ro/rw bit from the mount flag.
opts := "rw"
- if mnt.readOnly() {
+ if mnt.ReadOnly() {
opts = "ro"
}