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

proc_reader: handle in_init_tree #3338

Merged
merged 3 commits into from
Jan 28, 2025
Merged

Conversation

will-isovalent
Copy link
Contributor

Recently we introduced the in_init_tree flag into execve map values to indicate whether
a process is a member of the initial process tree for a container. This worked well for
containers started after Tetragon, but broke for cases where the container was started
before Tetragon, since our procfs walk did not account for the in_init_tree flag. Fix this
behaviour by introducing logic in the procfs walk to account for this.

Fix in_init_tree flag for processes started before Tetragon.

@will-isovalent will-isovalent added the release-note/bug This PR fixes an issue in a previous release of Tetragon. label Jan 24, 2025
@will-isovalent will-isovalent requested a review from a team as a code owner January 24, 2025 16:42
@will-isovalent will-isovalent force-pushed the pr/will/in-init-tree-procfs branch 8 times, most recently from 2358040 to a03cd85 Compare January 24, 2025 19:41
@will-isovalent will-isovalent requested a review from tixxdz January 24, 2025 19:47
@will-isovalent
Copy link
Contributor Author

@tixxdz pulling you in for review for the changes in the third patch.

Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

LGTM, see also Jiri comments! much appreciated @will-isovalent

A subsequent commit in this series needs to user observertesthelper's docker-related
helpers in a test, but that creates an import cycle. Resolve the import cycle by moving
docker-related helpers into a separate package and maintain backward compatibility by
introducing deprecated stubs in observertesthelper that call into that new package.

Signed-off-by: William Findlay <[email protected]>
Recently we introduced the in_init_tree flag into execve map values to indicate whether
a process is a member of the initial process tree for a container. This worked well for
containers started after Tetragon, but broke for cases where the container was started
before Tetragon, since our procfs walk did not account for the in_init_tree flag. Fix this
behaviour by introducing logic in the procfs walk to account for this.

Signed-off-by: William Findlay <[email protected]>
In our CI environment, docker cgroups do not contain the key word docker. This caused the
procfs walker to fail to identify the container ID's of docker container processes started
before Tetragon. Add some naive logic to fall back to so that we can handle this case.

Signed-off-by: William Findlay <[email protected]>
@will-isovalent will-isovalent force-pushed the pr/will/in-init-tree-procfs branch from a03cd85 to df89bd1 Compare January 28, 2025 14:36
@will-isovalent will-isovalent merged commit 9988b44 into main Jan 28, 2025
39 checks passed
@will-isovalent will-isovalent deleted the pr/will/in-init-tree-procfs branch January 28, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/bug This PR fixes an issue in a previous release of Tetragon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants