diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-10-03 20:42:21 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-10-03 20:42:21 +0000 |
commit | 85367cc0cfe8f5b0f76f2fb2715cc79847c87dbd (patch) | |
tree | 1bc27afad0a5d14555dcb843ee5a0a410df0b5e0 /pkg/sentry | |
parent | 73bf2f9805f0d474550bef11349499636bb5016f (diff) | |
parent | db218fdfcf16b664c990f02c94ed89ac2c1ad314 (diff) |
Merge release-20190806.1-233-gdb218fd (automated)
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_splice.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_splice.go b/pkg/sentry/syscalls/linux/sys_splice.go index 9f705ebca..dd3a5807f 100644 --- a/pkg/sentry/syscalls/linux/sys_splice.go +++ b/pkg/sentry/syscalls/linux/sys_splice.go @@ -159,9 +159,14 @@ func Sendfile(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc }, outFile.Flags().NonBlocking) } + // Sendfile can't lose any data because inFD is always a regual file. + if n != 0 { + err = nil + } + // We can only pass a single file to handleIOError, so pick inFile // arbitrarily. This is used only for debugging purposes. - return uintptr(n), nil, handleIOError(t, n != 0, err, kernel.ERESTARTSYS, "sendfile", inFile) + return uintptr(n), nil, handleIOError(t, false, err, kernel.ERESTARTSYS, "sendfile", inFile) } // Splice implements splice(2). @@ -305,6 +310,11 @@ func Tee(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallCo Dup: true, }, nonBlock) + // Tee doesn't change a state of inFD, so it can't lose any data. + if n != 0 { + err = nil + } + // See above; inFile is chosen arbitrarily here. - return uintptr(n), nil, handleIOError(t, n != 0, err, kernel.ERESTARTSYS, "tee", inFile) + return uintptr(n), nil, handleIOError(t, false, err, kernel.ERESTARTSYS, "tee", inFile) } |