diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-03-13 08:56:47 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-13 08:58:04 -0700 |
commit | 8f8f16efafd48da3c5e4db329a90bb76620b2324 (patch) | |
tree | 4f181eb05c92f6cddaf7f6dc530f04aba9010136 /pkg/sentry/vfs/vfs.go | |
parent | f693e1334b6fd0bea26fad770dfec3aa7e03c59a (diff) |
Add support for mount flags
Plumbs MS_NOEXEC and MS_RDONLY. Others are TODO.
Updates #1623 #1193
PiperOrigin-RevId: 300764669
Diffstat (limited to 'pkg/sentry/vfs/vfs.go')
-rw-r--r-- | pkg/sentry/vfs/vfs.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index bde81e1ef..365e8b30d 100644 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -388,6 +388,11 @@ func (vfs *VirtualFilesystem) OpenAt(ctx context.Context, creds *auth.Credential // TODO(gvisor.dev/issue/1193): Move inside fsimpl to avoid another call // to FileDescription.Stat(). if opts.FileExec { + if fd.Mount().flags.NoExec { + fd.DecRef() + return nil, syserror.EACCES + } + // Only a regular file can be executed. stat, err := fd.Stat(ctx, StatOptions{Mask: linux.STATX_TYPE}) if err != nil { |