summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/netlink
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-11-18 18:22:53 +0000
committergVisor bot <gvisor-bot@google.com>2020-11-18 18:22:53 +0000
commit38e95b7a0943ef013f72de2e004af96fbf50883a (patch)
tree78b933e606bac1a2125473bb2bbe302f5bd4345a /pkg/sentry/socket/netlink
parent89d431b577df59d1f3bf52e2c21c4b54d60cb9db (diff)
parentfc342fb43960e5f75103e727cd122479e015d321 (diff)
Merge release-20201109.0-71-gfc342fb43 (automated)
Diffstat (limited to 'pkg/sentry/socket/netlink')
-rw-r--r--pkg/sentry/socket/netlink/netlink_state_autogen.go7
-rw-r--r--pkg/sentry/socket/netlink/socket.go12
2 files changed, 4 insertions, 15 deletions
diff --git a/pkg/sentry/socket/netlink/netlink_state_autogen.go b/pkg/sentry/socket/netlink/netlink_state_autogen.go
index 5c97816d0..307498c1c 100644
--- a/pkg/sentry/socket/netlink/netlink_state_autogen.go
+++ b/pkg/sentry/socket/netlink/netlink_state_autogen.go
@@ -44,7 +44,6 @@ func (s *socketOpsCommon) StateFields() []string {
"bound",
"portID",
"sendBufferSize",
- "passcred",
"filter",
}
}
@@ -62,8 +61,7 @@ func (s *socketOpsCommon) StateSave(stateSinkObject state.Sink) {
stateSinkObject.Save(6, &s.bound)
stateSinkObject.Save(7, &s.portID)
stateSinkObject.Save(8, &s.sendBufferSize)
- stateSinkObject.Save(9, &s.passcred)
- stateSinkObject.Save(10, &s.filter)
+ stateSinkObject.Save(9, &s.filter)
}
func (s *socketOpsCommon) afterLoad() {}
@@ -78,8 +76,7 @@ func (s *socketOpsCommon) StateLoad(stateSourceObject state.Source) {
stateSourceObject.Load(6, &s.bound)
stateSourceObject.Load(7, &s.portID)
stateSourceObject.Load(8, &s.sendBufferSize)
- stateSourceObject.Load(9, &s.passcred)
- stateSourceObject.Load(10, &s.filter)
+ stateSourceObject.Load(9, &s.filter)
}
func (k *kernelSCM) StateTypeName() string {
diff --git a/pkg/sentry/socket/netlink/socket.go b/pkg/sentry/socket/netlink/socket.go
index 3baad098b..057f4d294 100644
--- a/pkg/sentry/socket/netlink/socket.go
+++ b/pkg/sentry/socket/netlink/socket.go
@@ -120,9 +120,6 @@ type socketOpsCommon struct {
// fixed buffer but only consume this many bytes.
sendBufferSize uint32
- // passcred indicates if this socket wants SCM credentials.
- passcred bool
-
// filter indicates that this socket has a BPF filter "installed".
//
// TODO(gvisor.dev/issue/1119): We don't actually support filtering,
@@ -201,10 +198,7 @@ func (s *socketOpsCommon) EventUnregister(e *waiter.Entry) {
// Passcred implements transport.Credentialer.Passcred.
func (s *socketOpsCommon) Passcred() bool {
- s.mu.Lock()
- passcred := s.passcred
- s.mu.Unlock()
- return passcred
+ return s.ep.SocketOptions().GetPassCred()
}
// ConnectedPasscred implements transport.Credentialer.ConnectedPasscred.
@@ -419,9 +413,7 @@ func (s *socketOpsCommon) SetSockOpt(t *kernel.Task, level int, name int, opt []
}
passcred := usermem.ByteOrder.Uint32(opt)
- s.mu.Lock()
- s.passcred = passcred != 0
- s.mu.Unlock()
+ s.ep.SocketOptions().SetPassCred(passcred != 0)
return nil
case linux.SO_ATTACH_FILTER: