Skip to content

Commit

Permalink
[CWS] Delete cgroup from cache for non container cgroups (#32612)
Browse files Browse the repository at this point in the history
  • Loading branch information
lebauce authored Jan 3, 2025
1 parent 6bb724c commit 77073bc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 0 additions & 12 deletions pkg/security/resolvers/cgroup/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type ResolverInterface interface {
AddPID(*model.ProcessCacheEntry)
GetWorkload(containerutils.ContainerID) (*cgroupModel.CacheEntry, bool)
DelPID(uint32)
DelPIDWithID(containerutils.ContainerID, uint32)
Len() int
RegisterListener(Event, utils.Listener[*cgroupModel.CacheEntry]) error
}
Expand Down Expand Up @@ -176,17 +175,6 @@ func (cr *Resolver) DelPID(pid uint32) {
}
}

// DelPIDWithID removes a PID from the cgroup cache entry referenced by the provided ID
func (cr *Resolver) DelPIDWithID(id containerutils.ContainerID, pid uint32) {
cr.Lock()
defer cr.Unlock()

entry, exists := cr.containerWorkloads.Get(id)
if exists {
cr.deleteWorkloadPID(pid, entry)
}
}

// deleteWorkloadPID removes a PID from a workload
func (cr *Resolver) deleteWorkloadPID(pid uint32, workload *cgroupModel.CacheEntry) {
workload.Lock()
Expand Down
2 changes: 1 addition & 1 deletion pkg/security/resolvers/process/resolver_ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (p *EBPFResolver) deleteEntry(pid uint32, exitTime time.Time) {
}

if p.cgroupResolver != nil {
p.cgroupResolver.DelPIDWithID(entry.ContainerID, entry.Pid)
p.cgroupResolver.DelPID(entry.Pid)
}

entry.Exit(exitTime)
Expand Down

0 comments on commit 77073bc

Please sign in to comment.