diff options
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_file.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go index 9b8374ef6..94a876332 100644 --- a/pkg/sentry/syscalls/linux/sys_file.go +++ b/pkg/sentry/syscalls/linux/sys_file.go @@ -871,7 +871,7 @@ const ( func Fadvise64(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) { fd := kdefs.FD(args[0].Int()) offset := args[1].Int64() - length := args[2].Uint() + length := args[2].Int64() advice := args[3].Int() if offset < 0 || length < 0 { @@ -884,6 +884,11 @@ func Fadvise64(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys } defer file.DecRef() + // If the FD refers to a pipe or FIFO, return error. + if fs.IsPipe(file.Dirent.Inode.StableAttr) { + return 0, nil, syserror.ESPIPE + } + switch advice { case _FADV_NORMAL: case _FADV_RANDOM: |