diff options
author | Rahat Mahmood <rahat@google.com> | 2019-03-20 14:30:00 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-20 14:31:16 -0700 |
commit | 81f4829d1195276d037f8bd23a2ef69e88f5ae6c (patch) | |
tree | d03b2e4eef897feaaf9d7f9b37f61a9b19bee01e /pkg/sentry/socket/rpcinet | |
parent | c7877b0a14778af9165eb2b841513b6f7dfdcbee (diff) |
Record sockets created during accept(2) for all families.
Track new sockets created during accept(2) in the socket table for all
families. Previously we were only doing this for unix domain sockets.
PiperOrigin-RevId: 239475550
Change-Id: I16f009f24a06245bfd1d72ffd2175200f837c6ac
Diffstat (limited to 'pkg/sentry/socket/rpcinet')
-rw-r--r-- | pkg/sentry/socket/rpcinet/socket.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go index 13681100e..548a22f32 100644 --- a/pkg/sentry/socket/rpcinet/socket.go +++ b/pkg/sentry/socket/rpcinet/socket.go @@ -52,6 +52,7 @@ type socketOperations struct { fsutil.FileNoMMap `state:"nosave"` socket.SendReceiveTimeout + family int // Read-only. fd uint32 // must be O_NONBLOCK wq *waiter.Queue rpcConn *conn.RPCConnection @@ -83,6 +84,7 @@ func newSocketFile(ctx context.Context, stack *Stack, family int, skType int, pr dirent := socket.NewDirent(ctx, socketDevice) defer dirent.DecRef() return fs.NewFile(ctx, dirent, fs.FileFlags{Read: true, Write: true}, &socketOperations{ + family: family, wq: &wq, fd: fd, rpcConn: stack.rpcConn, @@ -329,6 +331,7 @@ func (s *socketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, if err != nil { return 0, nil, 0, syserr.FromError(err) } + t.Kernel().RecordSocket(file, s.family) if peerRequested { return fd, payload.Address.Address, payload.Address.Length, nil |