diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-04-06 17:55:16 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-06 17:55:16 +0000 |
commit | 8896fc29043691bdc617602c59d739c1fcaa4ede (patch) | |
tree | 0b7fcd7232b729862a8486c3bde75b024a2b0fa7 /pkg/sentry/vfs/file_description.go | |
parent | 5f4a9864b33f23651bbea5904a3624086276af4e (diff) | |
parent | f332a864e8cc7799332838deffab37244ff8ffc7 (diff) |
Merge release-20200323.0-74-gf332a86 (automated)
Diffstat (limited to 'pkg/sentry/vfs/file_description.go')
-rwxr-xr-x | pkg/sentry/vfs/file_description.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/file_description.go b/pkg/sentry/vfs/file_description.go index 28e93a441..20c545fca 100755 --- a/pkg/sentry/vfs/file_description.go +++ b/pkg/sentry/vfs/file_description.go @@ -91,6 +91,10 @@ type FileDescriptionOptions struct { // ESPIPE. DenyPWrite bool + // if InvalidWrite is true, calls to FileDescription.Write() return + // EINVAL. + InvalidWrite bool + // If UseDentryMetadata is true, calls to FileDescription methods that // interact with file and filesystem metadata (Stat, SetStat, StatFS, // Listxattr, Getxattr, Setxattr, Removexattr) are implemented by calling @@ -562,6 +566,9 @@ func (fd *FileDescription) PWrite(ctx context.Context, src usermem.IOSequence, o // Write is similar to PWrite, but does not specify an offset. func (fd *FileDescription) Write(ctx context.Context, src usermem.IOSequence, opts WriteOptions) (int64, error) { + if fd.opts.InvalidWrite { + return 0, syserror.EINVAL + } if !fd.writable { return 0, syserror.EBADF } |