diff options
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/fd_table_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/kernel/fs_context_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/kernel/ipc_namespace_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/kernel/process_group_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/kernel/session_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/kernel/shm/shm_refs.go | 9 |
6 files changed, 12 insertions, 42 deletions
diff --git a/pkg/sentry/kernel/fd_table_refs.go b/pkg/sentry/kernel/fd_table_refs.go index f540ba371..ddbe50261 100644 --- a/pkg/sentry/kernel/fd_table_refs.go +++ b/pkg/sentry/kernel/fd_table_refs.go @@ -54,11 +54,6 @@ func (r *FDTableRefs) LogRefs() bool { return FDTableenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *FDTableRefs) 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 *FDTableRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *FDTableRefs) TryIncRef() bool { func (r *FDTableRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if FDTableenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *FDTableRefs) DecRef(destroy func()) { func (r *FDTableRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/kernel/fs_context_refs.go b/pkg/sentry/kernel/fs_context_refs.go index 6510157c7..d97c82fc9 100644 --- a/pkg/sentry/kernel/fs_context_refs.go +++ b/pkg/sentry/kernel/fs_context_refs.go @@ -54,11 +54,6 @@ func (r *FSContextRefs) LogRefs() bool { return FSContextenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *FSContextRefs) 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 *FSContextRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *FSContextRefs) TryIncRef() bool { func (r *FSContextRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if FSContextenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *FSContextRefs) DecRef(destroy func()) { func (r *FSContextRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/kernel/ipc_namespace_refs.go b/pkg/sentry/kernel/ipc_namespace_refs.go index c0acf2f50..a2a2d3458 100644 --- a/pkg/sentry/kernel/ipc_namespace_refs.go +++ b/pkg/sentry/kernel/ipc_namespace_refs.go @@ -54,11 +54,6 @@ func (r *IPCNamespaceRefs) LogRefs() bool { return IPCNamespaceenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *IPCNamespaceRefs) 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 *IPCNamespaceRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *IPCNamespaceRefs) TryIncRef() bool { func (r *IPCNamespaceRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if IPCNamespaceenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *IPCNamespaceRefs) DecRef(destroy func()) { func (r *IPCNamespaceRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/kernel/process_group_refs.go b/pkg/sentry/kernel/process_group_refs.go index a9cc69b35..51b0fcd34 100644 --- a/pkg/sentry/kernel/process_group_refs.go +++ b/pkg/sentry/kernel/process_group_refs.go @@ -54,11 +54,6 @@ func (r *ProcessGroupRefs) LogRefs() bool { return ProcessGroupenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *ProcessGroupRefs) 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 *ProcessGroupRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *ProcessGroupRefs) TryIncRef() bool { func (r *ProcessGroupRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if ProcessGroupenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *ProcessGroupRefs) DecRef(destroy func()) { func (r *ProcessGroupRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/kernel/session_refs.go b/pkg/sentry/kernel/session_refs.go index 0856ff261..84919943d 100644 --- a/pkg/sentry/kernel/session_refs.go +++ b/pkg/sentry/kernel/session_refs.go @@ -54,11 +54,6 @@ func (r *SessionRefs) LogRefs() bool { return SessionenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *SessionRefs) 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 *SessionRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *SessionRefs) TryIncRef() bool { func (r *SessionRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if SessionenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *SessionRefs) DecRef(destroy func()) { func (r *SessionRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/kernel/shm/shm_refs.go b/pkg/sentry/kernel/shm/shm_refs.go index 82ca1ed06..f550c7ca1 100644 --- a/pkg/sentry/kernel/shm/shm_refs.go +++ b/pkg/sentry/kernel/shm/shm_refs.go @@ -54,11 +54,6 @@ func (r *ShmRefs) LogRefs() bool { return ShmenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *ShmRefs) 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 *ShmRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *ShmRefs) TryIncRef() bool { func (r *ShmRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if ShmenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *ShmRefs) DecRef(destroy func()) { func (r *ShmRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } |