-
Notifications
You must be signed in to change notification settings - Fork 431
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
[REFACTOR] Separate probes and add new required field for probe dependencies #1791
[REFACTOR] Separate probes and add new required field for probe dependencies #1791
Conversation
e93b7de
to
414085b
Compare
I'm +1 on this if @yanivagman is (as his team will have a bigger impact on this change, by having the probes declared in another file). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change.
I think the probes package should be under the ebpf package.
Also see some other comments I have.
@@ -43,7 +32,7 @@ type EventDefinition struct { | |||
Name string | |||
Internal bool | |||
Syscall bool | |||
Probes []probe | |||
Probes []probeDependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should now move this to Dependencies, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually had the same thought initially as well, but when I wrote it out it quickly got too nested for my taste, so I opted to keep it this way.
And since almost all events besides the syscall ones have at least one probe, I think probes can get their own special category.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why not just keeping it "probe"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still thought the name fits more, but it looked worse inside the Dependencies struct. I can rename it back if you find it important that it shouldn't be named xDependency if it's not inside Dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can keep it outside of dependencies, but I would keep it probe (no hard feelings about that though)
I moved the package since it made the naming less cumbersome. Otherwise it would be namespaced with the events, and some of them have almost the same name. |
414085b
to
3b7501e
Compare
2159fd8
to
d745f0f
Compare
Can you give an example? |
Most of the probes have an event equivalent (I was considering writing a quick probe -> event transformation function but it seemed overkill). So as for example i'll list the exceptions:
There may be a couple more but these are probes that do not have an equivalent event. The other probes have at least one "equivalent" event, and sometimes other events which can depend on them (For example SchedProccessExecEvent depends on both the SchedProcessExec probe and the LoadElfPhdrs probe(sidenote to that: perhaps this probe should be optional for that event)). |
But how will this make naming cumbersome if we put the probes package under the ebpf package? |
359922d
to
c6dac8f
Compare
Because then we would have many probes and events named almost the same for exmaple VfsWriteEventID <-> VfsWriteProbe and so on... IMO, the events should also be split from the ebpf package and so we could remove the whole EventID from all of them, but this isn't in the scope of this PR. |
I don't think it's a problem that we have many probes and events named almost the same.
Agree. |
It's not breaking or anything, but I think it makes the code less orderly and readable and the namespace more cluttered. I also think there's some functional merit to having the probes in their own package, for example in PR #1804 there is some trigger mechanism introduced for the uprobes, this kind of functionality could (and IMO should) be defined in this package. If we had the event definitions also inside the events package we could have the clear separation like so:
I'm willing to take this next refactor PR on myself to justify this decision. I think the ebpf package, while an improvement from before is still very cluttered and it could use the cleanup, keeping the probes there doesn't do it any good in that regards. But - maybe for now it could be a subpackage like so |
This is exactly what I suggested :-)
Maybe I wasn't clear that I meant a subpackage in that sentence |
Haha, no I didn't get that from what you said initially. Alright i'll make that change. |
5129ed2
to
5abc2be
Compare
This is done through the following steps: 1. Split the probes into a separate module 2. Probes are handled implicitly through handles 3. Events have probe dependencies which includes a handle and a required field 4. Attaching failure is handled according to the required field
5abc2be
to
5bb22be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Initial Checklist
Description (git log)
This replaces the fix proposed in #1707
Fixes: #1622
Type of change
How Has This Been Tested?
Testing is done through the TRC-9 test in a tracee-tester image running on GKE. Some PR jobs were temporarily removed in this PR to test it faster. They will be added back.
When the tests are passed this checkbox will be filled. This PR shouldn't be merged until then.
Final Checklist:
Pick "Bug Fix" or "Feature", delete the other and mark appropriate checks.
Git Log Checklist:
My commits logs have: