summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/tmpfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-03-12 01:06:00 +0000
committergVisor bot <gvisor-bot@google.com>2021-03-12 01:06:00 +0000
commit8a7964657411d80c685128531099d6c246216f12 (patch)
tree43a12cad4774774951da1548519e59ecff0050ae /pkg/sentry/fsimpl/tmpfs
parent3bbc07ece91af55682430e6ae2a30060f5f7fd9c (diff)
parentc5667022b6617d732e0c0bcb8ca3b58d588ceafb (diff)
Merge release-20210301.0-37-gc5667022b (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/tmpfs')
-rw-r--r--pkg/sentry/fsimpl/tmpfs/filesystem.go5
-rw-r--r--pkg/sentry/fsimpl/tmpfs/tmpfs.go5
-rw-r--r--pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go11
3 files changed, 17 insertions, 4 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/filesystem.go b/pkg/sentry/fsimpl/tmpfs/filesystem.go
index 4f675c21e..5fdca1d46 100644
--- a/pkg/sentry/fsimpl/tmpfs/filesystem.go
+++ b/pkg/sentry/fsimpl/tmpfs/filesystem.go
@@ -898,3 +898,8 @@ func (fs *filesystem) PrependPath(ctx context.Context, vfsroot, vd vfs.VirtualDe
d = d.parent
}
}
+
+// MountOptions implements vfs.FilesystemImpl.MountOptions.
+func (fs *filesystem) MountOptions() string {
+ return fs.mopts
+}
diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs.go b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
index a01e413e0..8df81f589 100644
--- a/pkg/sentry/fsimpl/tmpfs/tmpfs.go
+++ b/pkg/sentry/fsimpl/tmpfs/tmpfs.go
@@ -70,6 +70,10 @@ type filesystem struct {
// devMinor is the filesystem's minor device number. devMinor is immutable.
devMinor uint32
+ // mopts contains the tmpfs-specific mount options passed to this
+ // filesystem. Immutable.
+ mopts string
+
// mu serializes changes to the Dentry tree.
mu sync.RWMutex `state:"nosave"`
@@ -184,6 +188,7 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt
mfp: mfp,
clock: clock,
devMinor: devMinor,
+ mopts: opts.Data,
}
fs.vfsfs.Init(vfsObj, newFSType, &fs)
diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
index 21c53afaf..bd0b0bf97 100644
--- a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
+++ b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
@@ -352,6 +352,7 @@ func (fs *filesystem) StateFields() []string {
"mfp",
"clock",
"devMinor",
+ "mopts",
"nextInoMinusOne",
"root",
}
@@ -365,8 +366,9 @@ func (fs *filesystem) StateSave(stateSinkObject state.Sink) {
stateSinkObject.Save(1, &fs.mfp)
stateSinkObject.Save(2, &fs.clock)
stateSinkObject.Save(3, &fs.devMinor)
- stateSinkObject.Save(4, &fs.nextInoMinusOne)
- stateSinkObject.Save(5, &fs.root)
+ stateSinkObject.Save(4, &fs.mopts)
+ stateSinkObject.Save(5, &fs.nextInoMinusOne)
+ stateSinkObject.Save(6, &fs.root)
}
func (fs *filesystem) afterLoad() {}
@@ -376,8 +378,9 @@ func (fs *filesystem) StateLoad(stateSourceObject state.Source) {
stateSourceObject.Load(1, &fs.mfp)
stateSourceObject.Load(2, &fs.clock)
stateSourceObject.Load(3, &fs.devMinor)
- stateSourceObject.Load(4, &fs.nextInoMinusOne)
- stateSourceObject.Load(5, &fs.root)
+ stateSourceObject.Load(4, &fs.mopts)
+ stateSourceObject.Load(5, &fs.nextInoMinusOne)
+ stateSourceObject.Load(6, &fs.root)
}
func (f *FilesystemOpts) StateTypeName() string {