diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-12-27 08:27:00 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-27 08:27:00 +0000 |
commit | 9c8909c933e58af2b9d20dc805b4d599317389d4 (patch) | |
tree | 219215ddc02d860bd56c73bc0229b22aaf6f847b /pkg/sentry/vfs/mount.go | |
parent | a69bbf7322da8463898947dce0d9ce840551efa4 (diff) | |
parent | 796f53c0befc21570b185811e26b74e71950dfc3 (diff) |
Merge release-20191213.0-55-g796f53c (automated)
Diffstat (limited to 'pkg/sentry/vfs/mount.go')
-rwxr-xr-x | pkg/sentry/vfs/mount.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pkg/sentry/vfs/mount.go b/pkg/sentry/vfs/mount.go index ec23ab0dd..00177b371 100755 --- a/pkg/sentry/vfs/mount.go +++ b/pkg/sentry/vfs/mount.go @@ -112,11 +112,11 @@ type MountNamespace struct { // configured by the given arguments. A reference is taken on the returned // MountNamespace. func (vfs *VirtualFilesystem) NewMountNamespace(ctx context.Context, creds *auth.Credentials, source, fsTypeName string, opts *GetFilesystemOptions) (*MountNamespace, error) { - fsType := vfs.getFilesystemType(fsTypeName) - if fsType == nil { + rft := vfs.getFilesystemType(fsTypeName) + if rft == nil { return nil, syserror.ENODEV } - fs, root, err := fsType.GetFilesystem(ctx, vfs, creds, source, *opts) + fs, root, err := rft.fsType.GetFilesystem(ctx, vfs, creds, source, *opts) if err != nil { return nil, err } @@ -136,11 +136,14 @@ func (vfs *VirtualFilesystem) NewMountNamespace(ctx context.Context, creds *auth // MountAt creates and mounts a Filesystem configured by the given arguments. func (vfs *VirtualFilesystem) MountAt(ctx context.Context, creds *auth.Credentials, source string, target *PathOperation, fsTypeName string, opts *MountOptions) error { - fsType := vfs.getFilesystemType(fsTypeName) - if fsType == nil { + rft := vfs.getFilesystemType(fsTypeName) + if rft == nil { return syserror.ENODEV } - fs, root, err := fsType.GetFilesystem(ctx, vfs, creds, source, opts.GetFilesystemOptions) + if !opts.InternalMount && !rft.opts.AllowUserMount { + return syserror.ENODEV + } + fs, root, err := rft.fsType.GetFilesystem(ctx, vfs, creds, source, opts.GetFilesystemOptions) if err != nil { return err } |