From 45566fa4e4bc55e870ae1d7f80778be8432bdef5 Mon Sep 17 00:00:00 2001 From: Ian Gudger Date: Fri, 28 Jun 2019 20:06:33 -0700 Subject: Add finalizer on AtomicRefCount to check for leaks. PiperOrigin-RevId: 255711454 --- runsc/boot/BUILD | 1 + runsc/boot/loader.go | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'runsc/boot') diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD index 7ec15a524..d91f66d95 100644 --- a/runsc/boot/BUILD +++ b/runsc/boot/BUILD @@ -34,6 +34,7 @@ go_library( "//pkg/log", "//pkg/memutil", "//pkg/rand", + "//pkg/refs", "//pkg/sentry/arch", "//pkg/sentry/arch:registers_go_proto", "//pkg/sentry/context", diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index 41027416d..89f7d9f94 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -32,6 +32,7 @@ import ( "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/memutil" "gvisor.dev/gvisor/pkg/rand" + "gvisor.dev/gvisor/pkg/refs" "gvisor.dev/gvisor/pkg/sentry/arch" "gvisor.dev/gvisor/pkg/sentry/control" "gvisor.dev/gvisor/pkg/sentry/fs/host" @@ -1006,3 +1007,8 @@ func (l *Loader) threadGroupFromIDLocked(key execID) (*kernel.ThreadGroup, *host } return ep.tg, ep.tty, nil } + +func init() { + // TODO(gvisor.dev/issue/365): Make this configurable. + refs.SetLeakMode(refs.NoLeakChecking) +} -- cgit v1.2.3