summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/socket/unix/transport/connectioned.go8
-rw-r--r--pkg/sentry/socket/unix/transport/connectionless.go2
-rw-r--r--pkg/sentry/socket/unix/transport/queue.go5
-rw-r--r--test/syscalls/linux/socket_unix_blocking_local.cc6
4 files changed, 7 insertions, 14 deletions
diff --git a/pkg/sentry/socket/unix/transport/connectioned.go b/pkg/sentry/socket/unix/transport/connectioned.go
index 7cfbbfe8a..62641bb34 100644
--- a/pkg/sentry/socket/unix/transport/connectioned.go
+++ b/pkg/sentry/socket/unix/transport/connectioned.go
@@ -135,8 +135,8 @@ func NewPair(stype SockType, uid UniqueIDProvider) (Endpoint, Endpoint) {
stype: stype,
}
- q1 := newQueue(a.Queue, b.Queue, initialLimit)
- q2 := newQueue(b.Queue, a.Queue, initialLimit)
+ q1 := &queue{ReaderQueue: a.Queue, WriterQueue: b.Queue, limit: initialLimit}
+ q2 := &queue{ReaderQueue: b.Queue, WriterQueue: a.Queue, limit: initialLimit}
if stype == SockStream {
a.receiver = &streamQueueReceiver{queueReceiver: queueReceiver{q1}}
@@ -286,13 +286,13 @@ func (e *connectionedEndpoint) BidirectionalConnect(ce ConnectingEndpoint, retur
stype: e.stype,
}
- readQueue := newQueue(ce.WaiterQueue(), ne.Queue, initialLimit)
+ readQueue := &queue{ReaderQueue: ce.WaiterQueue(), WriterQueue: ne.Queue, limit: initialLimit}
ne.connected = &connectedEndpoint{
endpoint: ce,
writeQueue: readQueue,
}
- writeQueue := newQueue(ne.Queue, ce.WaiterQueue(), initialLimit)
+ writeQueue := &queue{ReaderQueue: ne.Queue, WriterQueue: ce.WaiterQueue(), limit: initialLimit}
if e.stype == SockStream {
ne.receiver = &streamQueueReceiver{queueReceiver: queueReceiver{readQueue: writeQueue}}
} else {
diff --git a/pkg/sentry/socket/unix/transport/connectionless.go b/pkg/sentry/socket/unix/transport/connectionless.go
index f432a9717..728863f3f 100644
--- a/pkg/sentry/socket/unix/transport/connectionless.go
+++ b/pkg/sentry/socket/unix/transport/connectionless.go
@@ -34,7 +34,7 @@ type connectionlessEndpoint struct {
// NewConnectionless creates a new unbound dgram endpoint.
func NewConnectionless() Endpoint {
ep := &connectionlessEndpoint{baseEndpoint{Queue: &waiter.Queue{}}}
- ep.receiver = &queueReceiver{readQueue: newQueue(&waiter.Queue{}, ep.Queue, initialLimit)}
+ ep.receiver = &queueReceiver{readQueue: &queue{ReaderQueue: ep.Queue, WriterQueue: &waiter.Queue{}, limit: initialLimit}}
return ep
}
diff --git a/pkg/sentry/socket/unix/transport/queue.go b/pkg/sentry/socket/unix/transport/queue.go
index 05d1bdeef..45a58c600 100644
--- a/pkg/sentry/socket/unix/transport/queue.go
+++ b/pkg/sentry/socket/unix/transport/queue.go
@@ -38,11 +38,6 @@ type queue struct {
dataList messageList
}
-// newQueue allocates and initializes a new queue.
-func newQueue(ReaderQueue *waiter.Queue, WriterQueue *waiter.Queue, limit int64) *queue {
- return &queue{ReaderQueue: ReaderQueue, WriterQueue: WriterQueue, limit: limit}
-}
-
// Close closes q for reading and writing. It is immediately not writable and
// will become unreadable when no more data is pending.
//
diff --git a/test/syscalls/linux/socket_unix_blocking_local.cc b/test/syscalls/linux/socket_unix_blocking_local.cc
index f79e04b33..3c2105cc7 100644
--- a/test/syscalls/linux/socket_unix_blocking_local.cc
+++ b/test/syscalls/linux/socket_unix_blocking_local.cc
@@ -33,14 +33,12 @@ std::vector<SocketPairKind> GetSocketPairs() {
ApplyVec<SocketPairKind>(
FilesystemBoundUnixDomainSocketPair,
AllBitwiseCombinations(
- // FIXME: Add SOCK_DGRAM once blocking is fixed.
- List<int>{SOCK_STREAM, SOCK_SEQPACKET},
+ List<int>{SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM},
List<int>{0, SOCK_CLOEXEC})),
ApplyVec<SocketPairKind>(
AbstractBoundUnixDomainSocketPair,
AllBitwiseCombinations(
- // FIXME: Add SOCK_DGRAM once blocking is fixed.
- List<int>{SOCK_STREAM, SOCK_SEQPACKET},
+ List<int>{SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM},
List<int>{0, SOCK_CLOEXEC})));
}