-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process: comment how we process thread IDs in bpf and userspace
Our current rules now for how we collect thread IDs are: During bpf we send both TID and PID where: - fork TID == PID - exec TID == PID - [ku]probe or tracepoint TID could be different as per thread ID. - exit TID == PID => this is to match the exec evnet. At user space we have one entry that is the thread leader collected either during clone or exec: - fork TID == PID (asserts TID == PID received from BPF side) - exec TID == PID ditto - exit TID == PID => this is to match the exec evnet. - [ku]probe or tracepoint We make a copy of the process that is the thread leader in the process cache then update its TID that was recorded from bpf side. The copy is needed so we don't corrupt gRPC handling. Now this is by far complete, future fixes should include: - Record the capabilities and namespaces per thread in BPF side for [ku]probe and tracpoints and ensure to not overwrite the fields of the thread leader that are in the execve_map in bpf side or the user space process cache with fields of another thread, as that cache contains only one thread the leader. [Need to recheck sources] - Also ensure that [ku]probe and tracpoints events do use the per thread capabilities and namespaces fields collected from bpf side instead of the fields of the leader that is in the process cache which were collected during exec or during match filters... and not at current time. - Ensure that we always collect thread leader fields and we cache them in our shadow state in execve_map and user space process cache, reguardless of --enable-process-creds and a like flags. - When all these fixed and the model is clear, maybe by then we can remove the extra recording of TIDs from bpf side during fork/clone, exec and exit as we should by then asserted our model. Note that sending the TID that equals PID on clone exec and exit from BPF side and the assertion on the user space helps to catch errors for other Tetragon variants that use the OSS version as a base with custom sensors. The downside of this is we are just sending an extra 4bytes from bpf which is also fine. Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
- Loading branch information
Showing
8 changed files
with
93 additions
and
25 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
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