summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/syscalls/linux')
-rw-r--r--pkg/sentry/syscalls/linux/sys_file.go4
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