From 4feb5c7c263de2310608d1a0e608d4ffd5e2990f Mon Sep 17 00:00:00 2001 From: Dean Deng Date: Sat, 24 Oct 2020 07:46:30 -0700 Subject: Add leak checking to vfs2 structures that cannot use the refs_vfs2 template. Updates #1486. PiperOrigin-RevId: 338832085 --- pkg/sentry/fsimpl/gofer/directory.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/sentry/fsimpl/gofer/directory.go') diff --git a/pkg/sentry/fsimpl/gofer/directory.go b/pkg/sentry/fsimpl/gofer/directory.go index c3af30f49..e993c8e36 100644 --- a/pkg/sentry/fsimpl/gofer/directory.go +++ b/pkg/sentry/fsimpl/gofer/directory.go @@ -21,6 +21,7 @@ import ( "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/context" "gvisor.dev/gvisor/pkg/p9" + "gvisor.dev/gvisor/pkg/refsvfs2" "gvisor.dev/gvisor/pkg/sentry/kernel/auth" "gvisor.dev/gvisor/pkg/sentry/kernel/pipe" "gvisor.dev/gvisor/pkg/sentry/socket/unix/transport" @@ -100,6 +101,9 @@ func (d *dentry) createSyntheticChildLocked(opts *createSyntheticOpts) { hostFD: -1, nlink: uint32(2), } + if refsvfs2.LeakCheckEnabled() { + refsvfs2.Register(child, "gofer.dentry") + } switch opts.mode.FileType() { case linux.S_IFDIR: // Nothing else needs to be done. -- cgit v1.2.3