diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-03-14 13:46:55 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-14 13:48:06 -0700 |
commit | 97127750289b49dd5e29f8ddb4209137e47fe52d (patch) | |
tree | 592b9ea2217ede2e7093b01fddac8bb185910797 /pkg/sentry/fsimpl/proc/task.go | |
parent | 5e413cad10d2358a21dd08216953faee70e62a0b (diff) |
Disallow kernfs.Inode.SetStat for readonly inodes
Updates #1195, #1193
PiperOrigin-RevId: 300950993
Diffstat (limited to 'pkg/sentry/fsimpl/proc/task.go')
-rw-r--r-- | pkg/sentry/fsimpl/proc/task.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/pkg/sentry/fsimpl/proc/task.go b/pkg/sentry/fsimpl/proc/task.go index 4891caab6..fae3fc5aa 100644 --- a/pkg/sentry/fsimpl/proc/task.go +++ b/pkg/sentry/fsimpl/proc/task.go @@ -107,13 +107,9 @@ func (i *taskInode) Open(rp *vfs.ResolvingPath, vfsd *vfs.Dentry, opts vfs.OpenO return fd.VFSFileDescription(), nil } -// SetStat implements kernfs.Inode. -func (i *taskInode) SetStat(_ *vfs.Filesystem, opts vfs.SetStatOptions) error { - stat := opts.Stat - if stat.Mask&linux.STATX_MODE != 0 { - return syserror.EPERM - } - return nil +// SetStat implements Inode.SetStat not allowing inode attributes to be changed. +func (*taskInode) SetStat(*vfs.Filesystem, vfs.SetStatOptions) error { + return syserror.EPERM } // taskOwnedInode implements kernfs.Inode and overrides inode owner with task |