-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine parent state traversal w/ loop detection
Replace the ad-hoc parent thread state traversal that was in several filterchecks as well as in the mesos/coreos code with a central way to traverse parent thread state and detect potential loops at the same time. A new method traverse_parent_state traverses the parent state from the current thead and takes a function that is called for each thread while traversing. This prevents infinite loops like observed in falcosecurity/falco#208. This doesn't address the underlying cause of what caused the thread state to get corrupted in the first place. That's tracked by a separate issue #752. In the 4 filterchecks that used to traverse parent state (proc.sname, proc.loginshellid, proc.aname, proc.apid), replace the direct traversal with a call to traverse_parent_state + an appropriate visitor function. Update mesos's get_env_mesos_task_id, which used to do a combination of recursion and get_parent_task_id to traverse parent state, with a visitor and traverse_parent_state. It stops as soon as any of the environment variables for a thread are found. This version doesn't explicitly skip pid 1, but I don't think that was strictly necessary as init wouldn't have those environment variables anyway. Also replace a similar process in coreos to find rkt pods.
- Loading branch information
Showing
4 changed files
with
146 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters