summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-07-24 01:55:40 +0000
committergVisor bot <gvisor-bot@google.com>2020-07-24 01:55:40 +0000
commit16194f8fc21e75565404bbe9f832136d62125f01 (patch)
tree53faee0d1ce8bcf69db894aff49909b900556426 /pkg/sentry/syscalls/linux
parent02da1e7f79ef4b77e4e789546108e0e90420da72 (diff)
parentd9a3f5d0c7d675b3cb4519eccca341bac33456af (diff)
Merge release-20200622.1-210-gd9a3f5d0c (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux')
-rw-r--r--pkg/sentry/syscalls/linux/vfs2/setstat.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/syscalls/linux/vfs2/setstat.go b/pkg/sentry/syscalls/linux/vfs2/setstat.go
index 09ecfed26..6daedd173 100644
--- a/pkg/sentry/syscalls/linux/vfs2/setstat.go
+++ b/pkg/sentry/syscalls/linux/vfs2/setstat.go
@@ -178,6 +178,7 @@ func Truncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
Mask: linux.STATX_SIZE,
Size: uint64(length),
},
+ NeedWritePerm: true,
})
return 0, nil, handleSetSizeError(t, err)
}
@@ -197,6 +198,10 @@ func Ftruncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys
}
defer file.DecRef()
+ if !file.IsWritable() {
+ return 0, nil, syserror.EINVAL
+ }
+
err := file.SetStat(t, vfs.SetStatOptions{
Stat: linux.Statx{
Mask: linux.STATX_SIZE,