summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-02-09 09:40:03 +0000
committergVisor bot <gvisor-bot@google.com>2021-02-09 09:40:03 +0000
commit7dc93f4645e36b0faf2a56662740892085ef9afb (patch)
treeb7a7a50c96d7c29dc8232d4e125a15c21b231a14 /pkg/sentry/kernel
parentb55c5c8d97cac508f132306d7ee24c47705cc2db (diff)
parentd6dbe6e5ca5445dac278d3b6654af8d13379878a (diff)
Merge release-20210201.0-63-gd6dbe6e5c (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/pipe/pipe.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/sentry/kernel/pipe/pipe.go b/pkg/sentry/kernel/pipe/pipe.go
index c551acd99..2c8668fc4 100644
--- a/pkg/sentry/kernel/pipe/pipe.go
+++ b/pkg/sentry/kernel/pipe/pipe.go
@@ -247,11 +247,15 @@ func (p *Pipe) writeLocked(count int64, f func(safemem.BlockSeq) (uint64, error)
return 0, syscall.EPIPE
}
- // POSIX requires that a write smaller than atomicIOBytes (PIPE_BUF) be
- // atomic, but requires no atomicity for writes larger than this.
avail := p.max - p.size
+ if avail == 0 {
+ return 0, syserror.ErrWouldBlock
+ }
short := false
if count > avail {
+ // POSIX requires that a write smaller than atomicIOBytes
+ // (PIPE_BUF) be atomic, but requires no atomicity for writes
+ // larger than this.
if count <= atomicIOBytes {
return 0, syserror.ErrWouldBlock
}