summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r--pkg/sentry/mm/aio_mappable_refs.go9
-rw-r--r--pkg/sentry/mm/special_mappable_refs.go9
2 files changed, 4 insertions, 14 deletions
diff --git a/pkg/sentry/mm/aio_mappable_refs.go b/pkg/sentry/mm/aio_mappable_refs.go
index 500477c1f..4b87070bf 100644
--- a/pkg/sentry/mm/aio_mappable_refs.go
+++ b/pkg/sentry/mm/aio_mappable_refs.go
@@ -54,11 +54,6 @@ func (r *aioMappableRefs) LogRefs() bool {
return aioMappableenableLogging
}
-// EnableLeakCheck enables reference leak checking on r.
-func (r *aioMappableRefs) EnableLeakCheck() {
- refsvfs2.Register(r)
-}
-
// ReadRefs returns the current number of references. The returned count is
// inherently racy and is unsafe to use without external synchronization.
func (r *aioMappableRefs) ReadRefs() int64 {
@@ -115,7 +110,7 @@ func (r *aioMappableRefs) TryIncRef() bool {
func (r *aioMappableRefs) DecRef(destroy func()) {
v := atomic.AddInt64(&r.refCount, -1)
if aioMappableenableLogging {
- refsvfs2.LogDecRef(r, v+1)
+ refsvfs2.LogDecRef(r, v)
}
switch {
case v < 0:
@@ -132,6 +127,6 @@ func (r *aioMappableRefs) DecRef(destroy func()) {
func (r *aioMappableRefs) afterLoad() {
if r.ReadRefs() > 0 {
- r.EnableLeakCheck()
+ refsvfs2.Register(r)
}
}
diff --git a/pkg/sentry/mm/special_mappable_refs.go b/pkg/sentry/mm/special_mappable_refs.go
index 60b4b7e92..6c89e0f7e 100644
--- a/pkg/sentry/mm/special_mappable_refs.go
+++ b/pkg/sentry/mm/special_mappable_refs.go
@@ -54,11 +54,6 @@ func (r *SpecialMappableRefs) LogRefs() bool {
return SpecialMappableenableLogging
}
-// EnableLeakCheck enables reference leak checking on r.
-func (r *SpecialMappableRefs) EnableLeakCheck() {
- refsvfs2.Register(r)
-}
-
// ReadRefs returns the current number of references. The returned count is
// inherently racy and is unsafe to use without external synchronization.
func (r *SpecialMappableRefs) ReadRefs() int64 {
@@ -115,7 +110,7 @@ func (r *SpecialMappableRefs) TryIncRef() bool {
func (r *SpecialMappableRefs) DecRef(destroy func()) {
v := atomic.AddInt64(&r.refCount, -1)
if SpecialMappableenableLogging {
- refsvfs2.LogDecRef(r, v+1)
+ refsvfs2.LogDecRef(r, v)
}
switch {
case v < 0:
@@ -132,6 +127,6 @@ func (r *SpecialMappableRefs) DecRef(destroy func()) {
func (r *SpecialMappableRefs) afterLoad() {
if r.ReadRefs() > 0 {
- r.EnableLeakCheck()
+ refsvfs2.Register(r)
}
}