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

Fetch everything, everywhere, all at once. Issue #45 #47

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

haesbaert
Copy link
Collaborator

@haesbaert haesbaert commented Jul 1, 2024

This diff unifies the tracking of task_struct{} across all probes and ebpf events. We now update ~all task_struct values everywhere we can.

Now exit and exec embed a raw_task{} into their own raw_type and functions taht operate solely on raw_task{} have been unified so we stop repeating code.

TASK_SAMPLE takes a parameter for register as maybe we will have to track from another register in the future

Now samples can include TASK_SAMPLE, like exec_connector does. This creates an issue as before we were creating the wire protocol carefully aligned by making sure it's all ordered 64->32->16->8 and so on. If we place TASK_SAMPLE in the beginning of the sample, we might end up unaligned, but if we add it in the end, then a task_sample stops being standalone as it defines probe_ip like all other samples.

We solve this by defining an aligned/non-padded task_sample, and we enforce this via #pragma forbidden magic. Luckly it is aligned in its current state, if we add more members in the future, we may manually pad it with additional members.

We also start getting ppid from the wire instead of hardcoding it, that's because ppid might change either when a process daemonizes or when docker is doing its magic to start a container, which can change ppid multiple times via PR_SET_CHILD_SUBREAPER blood magic. See issue #43.

This PR is pending on the merge of elastic/ebpf#197

@haesbaert haesbaert marked this pull request as ready for review July 2, 2024 08:53
Copy link
Contributor

@nicholasberlin nicholasberlin left a comment

Choose a reason for hiding this comment

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

LGTM

This diff unifies the tracking of task_struct{} across all probes and ebpf
events. We now update ~all task_struct values everywhere we can.

Now exit and exec embed a raw_task{} into their own raw_type and functions taht
operate solely on raw_task{} have been unified so we stop repeating code.

TASK_SAMPLE takes a parameter for register as maybe we will have to track from
another register in the future

Now samples can include TASK_SAMPLE, like exec_connector does. This creates an
issue as before we were creating the wire protocol carefully aligned by making
sure it's all ordered 64->32->16->8 and so on. If we place TASK_SAMPLE in the
beginning of the sample, we might end up unaligned, but if we add it in the end,
then a task_sample stops being standalone as it defines `probe_ip` like all
other samples.

We solve this by defining an aligned/non-padded task_sample, and we enforce this
via #pragma forbidden magic. Luckly it is aligned in its current state, if we
add more members in the future, we may manually pad it with additional members.

We also start getting ppid from the wire instead of hardcoding it, that's
because ppid might change either when a process daemonizes or when docker is
doing its magic to start a container, which can change ppid multiple times via
PR_SET_CHILD_SUBREAPER blood magic. See issue #43.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants