From be9a5c8b5d93db10acffd641efa01348417a31e6 Mon Sep 17 00:00:00 2001 From: Bryce Kahle Date: Thu, 11 Nov 2021 12:34:19 -0800 Subject: [PATCH] Ensure we do not attempt to cleanup probes from ourself gopsutil is trying to use /host/proc which doesn't understand the container PID namespace, so we were attempting to cleanup probes from our own process. --- manager/manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/manager.go b/manager/manager.go index 34fbd8b7a..6ec45fa02 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -1126,7 +1126,7 @@ func (m *Manager) UpdateActivatedProbes(selectors []ProbesSelector) error { } } - for id, _ := range nextProbes { + for id := range nextProbes { if _, alreadyPresent := currentProbes[id]; alreadyPresent { delete(currentProbes, id) } else { @@ -1524,7 +1524,7 @@ func (m *Manager) cleanupTracefs() error { // clean up kprobe_events var cleanUpErrors *multierror.Error - pidMask := make(map[int]procMask) + pidMask := map[int]procMask{os.Getpid(): Running} cleanUpErrors = multierror.Append(cleanUpErrors, cleanupKprobeEvents(pattern, pidMask)) cleanUpErrors = multierror.Append(cleanUpErrors, cleanupUprobeEvents(pattern, pidMask)) if cleanUpErrors.Len() == 0 {