summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/sys/sys.go
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2020-11-09 08:30:29 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-09 08:33:17 -0800
commit0fb5353e45f166460d5846576c20479072207a06 (patch)
treef88e4472c07f56e4d34b14743e1a3afaafab62e1 /pkg/sentry/fsimpl/sys/sys.go
parent78cce3a46b953cab00731f8afacf7e9e7f4dc751 (diff)
Initialize references with a value of 1.
This lets us avoid treating a value of 0 as one reference. All references using the refsvfs2 template must call InitRefs() before the reference is incremented/decremented, or else a panic will occur. Therefore, it should be pretty easy to identify missing InitRef calls during testing. Updates #1486. PiperOrigin-RevId: 341411151
Diffstat (limited to 'pkg/sentry/fsimpl/sys/sys.go')
-rw-r--r--pkg/sentry/fsimpl/sys/sys.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/sys/sys.go b/pkg/sentry/fsimpl/sys/sys.go
index 506a2a0f0..79bc3fe88 100644
--- a/pkg/sentry/fsimpl/sys/sys.go
+++ b/pkg/sentry/fsimpl/sys/sys.go
@@ -160,7 +160,7 @@ func (fs *filesystem) newDir(ctx context.Context, creds *auth.Credentials, mode
d := &dir{}
d.InodeAttrs.Init(ctx, creds, linux.UNNAMED_MAJOR, fs.devMinor, fs.NextIno(), linux.ModeDirectory|0755)
d.OrderedChildren.Init(kernfs.OrderedChildrenOptions{})
- d.EnableLeakCheck()
+ d.InitRefs()
d.IncLinks(d.OrderedChildren.Populate(contents))
return d
}