diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-07-17 23:20:44 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-17 23:20:44 +0000 |
commit | 9f4e682c1c3b4061308f82f3d9e01de0778d111a (patch) | |
tree | e96e4f291fa9c0814053983570511790084437e1 | |
parent | 85f25d97ff2a21e74052168f05f70b891bd912df (diff) | |
parent | 6f7e2bb388cb29a355dece8921671c0085f53ea9 (diff) |
Merge 6f7e2bb3 (automated)
-rw-r--r-- | pkg/abi/linux/file.go | 3 | ||||
-rw-r--r-- | pkg/sentry/fs/flags.go | 9 | ||||
-rwxr-xr-x | pkg/sentry/fs/fs_state_autogen.go | 2 | ||||
-rw-r--r-- | pkg/sentry/fs/mount_overlay.go | 16 | ||||
-rwxr-xr-x | pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go | 3 | ||||
-rwxr-xr-x | pkg/sentry/platform/ring0/defs_impl.go | 6 | ||||
-rw-r--r-- | pkg/sentry/syscalls/linux/flags.go | 1 | ||||
-rwxr-xr-x | pkg/sentry/time/seqatomic_parameters_unsafe.go | 3 |
8 files changed, 30 insertions, 13 deletions
diff --git a/pkg/abi/linux/file.go b/pkg/abi/linux/file.go index f78ffaa82..285338e47 100644 --- a/pkg/abi/linux/file.go +++ b/pkg/abi/linux/file.go @@ -34,13 +34,14 @@ const ( O_TRUNC = 00001000 O_APPEND = 00002000 O_NONBLOCK = 00004000 + O_DSYNC = 00010000 O_ASYNC = 00020000 O_DIRECT = 00040000 O_LARGEFILE = 00100000 O_DIRECTORY = 00200000 O_NOFOLLOW = 00400000 O_CLOEXEC = 02000000 - O_SYNC = 04010000 + O_SYNC = 04000000 O_PATH = 010000000 ) diff --git a/pkg/sentry/fs/flags.go b/pkg/sentry/fs/flags.go index 1278f9c78..0fab876a9 100644 --- a/pkg/sentry/fs/flags.go +++ b/pkg/sentry/fs/flags.go @@ -28,7 +28,11 @@ type FileFlags struct { // NonBlocking indicates that I/O should not block. NonBlocking bool - // Sync indicates that any writes should be synchronous. + // DSync indicates that each write will flush data and metadata required to + // read the file's contents. + DSync bool + + // Sync indicates that each write will flush data and all file metadata. Sync bool // Append indicates this file is append only. @@ -96,6 +100,9 @@ func (f FileFlags) ToLinux() (mask uint) { if f.NonBlocking { mask |= linux.O_NONBLOCK } + if f.DSync { + mask |= linux.O_DSYNC + } if f.Sync { mask |= linux.O_SYNC } diff --git a/pkg/sentry/fs/fs_state_autogen.go b/pkg/sentry/fs/fs_state_autogen.go index 78505db1d..5ea2669e6 100755 --- a/pkg/sentry/fs/fs_state_autogen.go +++ b/pkg/sentry/fs/fs_state_autogen.go @@ -342,6 +342,7 @@ func (x *FileFlags) save(m state.Map) { x.beforeSave() m.Save("Direct", &x.Direct) m.Save("NonBlocking", &x.NonBlocking) + m.Save("DSync", &x.DSync) m.Save("Sync", &x.Sync) m.Save("Append", &x.Append) m.Save("Read", &x.Read) @@ -358,6 +359,7 @@ func (x *FileFlags) afterLoad() {} func (x *FileFlags) load(m state.Map) { m.Load("Direct", &x.Direct) m.Load("NonBlocking", &x.NonBlocking) + m.Load("DSync", &x.DSync) m.Load("Sync", &x.Sync) m.Load("Append", &x.Append) m.Load("Read", &x.Read) diff --git a/pkg/sentry/fs/mount_overlay.go b/pkg/sentry/fs/mount_overlay.go index 4fcdd6c01..299712cd7 100644 --- a/pkg/sentry/fs/mount_overlay.go +++ b/pkg/sentry/fs/mount_overlay.go @@ -66,13 +66,17 @@ func (o *overlayMountSourceOperations) Revalidate(ctx context.Context, name stri panic("an overlay cannot revalidate file objects from the lower fs") } - // Do we have anything to revalidate? - if child.overlay.upper == nil { - return false + var revalidate bool + child.overlay.copyMu.RLock() + if child.overlay.upper != nil { + // Does the upper require revalidation? + revalidate = o.upper.Revalidate(ctx, name, parent.overlay.upper, child.overlay.upper) + } else { + // Nothing to revalidate. + revalidate = false } - - // Does the upper require revalidation? - return o.upper.Revalidate(ctx, name, parent.overlay.upper, child.overlay.upper) + child.overlay.copyMu.RUnlock() + return revalidate } // Keep implements MountSourceOperations by delegating to the upper diff --git a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go index be6b07629..25ad17a4e 100755 --- a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go +++ b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go @@ -2,10 +2,11 @@ package kernel import ( "fmt" - "gvisor.dev/gvisor/third_party/gvsync" "reflect" "strings" "unsafe" + + "gvisor.dev/gvisor/third_party/gvsync" ) // SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race diff --git a/pkg/sentry/platform/ring0/defs_impl.go b/pkg/sentry/platform/ring0/defs_impl.go index ea3f514cd..acae012dc 100755 --- a/pkg/sentry/platform/ring0/defs_impl.go +++ b/pkg/sentry/platform/ring0/defs_impl.go @@ -1,14 +1,14 @@ package ring0 import ( + "fmt" "gvisor.dev/gvisor/pkg/cpuid" + "io" + "reflect" "syscall" - "fmt" "gvisor.dev/gvisor/pkg/sentry/platform/ring0/pagetables" "gvisor.dev/gvisor/pkg/sentry/usermem" - "io" - "reflect" ) var ( diff --git a/pkg/sentry/syscalls/linux/flags.go b/pkg/sentry/syscalls/linux/flags.go index 0c1b5ec27..444f2b004 100644 --- a/pkg/sentry/syscalls/linux/flags.go +++ b/pkg/sentry/syscalls/linux/flags.go @@ -41,6 +41,7 @@ func flagsToPermissions(mask uint) (p fs.PermMask) { func linuxToFlags(mask uint) fs.FileFlags { return fs.FileFlags{ Direct: mask&linux.O_DIRECT != 0, + DSync: mask&(linux.O_DSYNC|linux.O_SYNC) != 0, Sync: mask&linux.O_SYNC != 0, NonBlocking: mask&linux.O_NONBLOCK != 0, Read: (mask & linux.O_ACCMODE) != linux.O_WRONLY, diff --git a/pkg/sentry/time/seqatomic_parameters_unsafe.go b/pkg/sentry/time/seqatomic_parameters_unsafe.go index b4fb0a7f0..89792c56d 100755 --- a/pkg/sentry/time/seqatomic_parameters_unsafe.go +++ b/pkg/sentry/time/seqatomic_parameters_unsafe.go @@ -2,10 +2,11 @@ package time import ( "fmt" - "gvisor.dev/gvisor/third_party/gvsync" "reflect" "strings" "unsafe" + + "gvisor.dev/gvisor/third_party/gvsync" ) // SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race |