diff options
author | Ian Gudger <igudger@google.com> | 2019-04-29 21:20:05 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-04-29 21:21:08 -0700 |
commit | 81ecd8b6eab7457b331762626f8c210fec3504e6 (patch) | |
tree | 4c5e5aaf3ac8ff475657c66671dd6828938ae45e /pkg/sentry/socket/unix/io.go | |
parent | 2843f2a956f5ef23e621f571f5c3e6a1e4a8223a (diff) |
Implement the MSG_CTRUNC msghdr flag for Unix sockets.
Updates google/gvisor#206
PiperOrigin-RevId: 245880573
Change-Id: Ifa715e98d47f64b8a32b04ae9378d6cd6bd4025e
Diffstat (limited to 'pkg/sentry/socket/unix/io.go')
-rw-r--r-- | pkg/sentry/socket/unix/io.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/sentry/socket/unix/io.go b/pkg/sentry/socket/unix/io.go index 382911d51..5a1475ec2 100644 --- a/pkg/sentry/socket/unix/io.go +++ b/pkg/sentry/socket/unix/io.go @@ -72,13 +72,18 @@ type EndpointReader struct { // Control contains the received control messages. Control transport.ControlMessages + + // ControlTrunc indicates that SCM_RIGHTS FDs were discarded based on + // the value of NumRights. + ControlTrunc bool } // ReadToBlocks implements safemem.Reader.ReadToBlocks. func (r *EndpointReader) ReadToBlocks(dsts safemem.BlockSeq) (uint64, error) { return safemem.FromVecReaderFunc{func(bufs [][]byte) (int64, error) { - n, ms, c, err := r.Endpoint.RecvMsg(bufs, r.Creds, r.NumRights, r.Peek, r.From) + n, ms, c, ct, err := r.Endpoint.RecvMsg(bufs, r.Creds, r.NumRights, r.Peek, r.From) r.Control = c + r.ControlTrunc = ct r.MsgSize = ms if err != nil { return int64(n), err.ToError() |