diff options
author | Michael Pratt <mpratt@google.com> | 2018-10-08 11:38:02 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-08 11:39:54 -0700 |
commit | 569c2b06c47d269d961405fa652d45e51860d005 (patch) | |
tree | aabbf7fc7e786d0699d9ea1d34f7048fb4339761 /pkg/sentry/syscalls | |
parent | e9e8be661328661b5527f1643727b9a13bbeab48 (diff) |
Statfs Namelen should be NAME_MAX not PATH_MAX
We accidentally set the wrong maximum. I've also added PATH_MAX and
NAME_MAX to the linux abi package.
PiperOrigin-RevId: 216221311
Change-Id: I44805fcf21508831809692184a0eba4cee469633
Diffstat (limited to 'pkg/sentry/syscalls')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_file.go | 4 | ||||
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_stat.go | 4 | ||||
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_thread.go | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go index 97881a1f5..015afda9b 100644 --- a/pkg/sentry/syscalls/linux/sys_file.go +++ b/pkg/sentry/syscalls/linux/sys_file.go @@ -115,7 +115,7 @@ func fileOpOn(t *kernel.Task, dirFD kdefs.FD, path string, resolve bool, fn func // copyInPath copies a path in. func copyInPath(t *kernel.Task, addr usermem.Addr, allowEmpty bool) (path string, dirPath bool, err error) { - path, err = t.CopyInString(addr, syscall.PathMax) + path, err = t.CopyInString(addr, linux.PATH_MAX) if err != nil { return "", false, err } @@ -1080,7 +1080,7 @@ func symlinkAt(t *kernel.Task, dirFD kdefs.FD, newAddr usermem.Addr, oldAddr use // The oldPath is copied in verbatim. This is because the symlink // will include all details, including trailing slashes. - oldPath, err := t.CopyInString(oldAddr, syscall.PathMax) + oldPath, err := t.CopyInString(oldAddr, linux.PATH_MAX) if err != nil { return err } diff --git a/pkg/sentry/syscalls/linux/sys_stat.go b/pkg/sentry/syscalls/linux/sys_stat.go index 6e21b34fd..619a14d7c 100644 --- a/pkg/sentry/syscalls/linux/sys_stat.go +++ b/pkg/sentry/syscalls/linux/sys_stat.go @@ -15,8 +15,6 @@ package linux import ( - "syscall" - "gvisor.googlesource.com/gvisor/pkg/abi/linux" "gvisor.googlesource.com/gvisor/pkg/sentry/arch" "gvisor.googlesource.com/gvisor/pkg/sentry/fs" @@ -198,7 +196,7 @@ func statfsImpl(t *kernel.Task, d *fs.Dirent, addr usermem.Addr) error { Files: info.TotalFiles, FilesFree: info.FreeFiles, // Same as Linux for simple_statfs, see fs/libfs.c. - NameLength: syscall.PathMax, + NameLength: linux.NAME_MAX, FragmentSize: d.Inode.StableAttr.BlockSize, // Leave other fields 0 like simple_statfs does. } diff --git a/pkg/sentry/syscalls/linux/sys_thread.go b/pkg/sentry/syscalls/linux/sys_thread.go index 0adbf160f..550f63a43 100644 --- a/pkg/sentry/syscalls/linux/sys_thread.go +++ b/pkg/sentry/syscalls/linux/sys_thread.go @@ -76,7 +76,7 @@ func Execve(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal envvAddr := args[2].Pointer() // Extract our arguments. - filename, err := t.CopyInString(filenameAddr, syscall.PathMax) + filename, err := t.CopyInString(filenameAddr, linux.PATH_MAX) if err != nil { return 0, nil, err } |