diff options
author | Chanwit Kaewkasi <chanwit@gmail.com> | 2018-05-16 14:19:34 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-05-16 14:20:24 -0700 |
commit | 3131a6b131127e70b5e3941e3c4d292d99312fa5 (patch) | |
tree | 1706afc243b8b6ca72d1afe907f9aca3be53d531 /pkg/sentry | |
parent | 5b4c20e1b83fad0691469a6b8a11a86f3453838a (diff) |
Verify that when offset address is not null, infile must be seekable
Change-Id: Id247399baeac58f6cd774acabd5d1da05e5b5697
PiperOrigin-RevId: 196887768
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_file.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go index 1d61ac9f0..9b8374ef6 100644 --- a/pkg/sentry/syscalls/linux/sys_file.go +++ b/pkg/sentry/syscalls/linux/sys_file.go @@ -1915,6 +1915,10 @@ func Sendfile(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc hasOffset := offsetAddr != 0 // If we have a provided offset. if hasOffset { + // Verify that when offset address is not null, infile must be seekable + if !inFile.Flags().Pread { + return 0, nil, syserror.ESPIPE + } // Copy in the offset. if _, err := t.CopyIn(offsetAddr, &offset); err != nil { return 0, nil, err |