Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.16.0] backport: dead cgroups fix #3326

Merged

Conversation

NDStrahilevitz
Copy link
Collaborator

Backport #3325

Certain kubernetes version make use of short lived cgroups for various
tasks (for example log rotation). These cgroups will generate events and
a very quick cgroup_rmdir event.
As such, many related events to the cgroup will attempt to query its
directory through the recursive path and not find it.

Commit adds a "Dead" field to the cgroup info to indicate a cgroup which
has already been removed. Various logical sections can refer to it if
its relevant to them, and more importantly, additional queries will not
be attempted.

Bonus: optimize away additional Stat syscall in containers by returning
the directory ctime in cgroup.GetCgroupPath.

commit: 0c5719a (main), cherry-pick
@josedonizetti
Copy link
Contributor

I'll merge it tmr, and release 0.16.2

@@ -389,10 +390,12 @@ func GetCgroupControllerHierarchy(subsys string) (int, error) {
// given cgroupId and subPath (related to cgroup fs root dir). If subPath is
// empty, then all directories from cgroup fs will be searched for the given
// cgroupId.
func GetCgroupPath(rootDir string, cgroupId uint64, subPath string) (string, error) {
//
// Returns found cgroup path, its ctime, and an error if relevant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: godoc formatting requires function name as the first string (I know this is a backport and has been merged already).

Copy link
Contributor

@rafaeldtinoco rafaeldtinoco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (including the original patch).

@josedonizetti josedonizetti merged commit 72ba864 into aquasecurity:v0.16.0 Jul 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants