-
Notifications
You must be signed in to change notification settings - Fork 172
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
chore(userspace/libscap): give name to bpf programs #559
Conversation
336774e
to
722d41f
Compare
/* 'event' looks like "raw_tracepoint/raw_syscalls/sys_enter". Skip | ||
* two '/' to find the last word, if possible. | ||
*/ | ||
prog_name = strstr(event, "/"); |
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'd use strrchr
instead, that automatically fetches last occurrence of '/'.
Then, if anything is found, we can use just prog_name++
.
@@ -513,6 +517,7 @@ static int32_t load_tracepoint(struct bpf_engine* handle, const char *event, str | |||
int err; | |||
int fd; | |||
int id; | |||
const char *prog_name; |
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 know it is super useless but it is future-proof 😆!
const char *prog_name; | |
const char *prog_name = NULL; |
This patch helps to distinguish Falco's bpf programs in bpftool or in 'kubectl gadget top ebpf'. Signed-off-by: Alban Crequy <albancrequy@microsoft.com>
722d41f
to
38ba7bd
Compare
Tested in Falco (on branch falcosecurity/falco#2177) with the following:
And in another terminal:
|
Very nice! Thanks! |
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.
/approve
LGTM label has been added. Git tree hash: 8598634c444118075ad30f625a0359f18f860bd0
|
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.
/approve
Thank you very much!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alban, Andreagit97, FedeDP The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Tested with Falco, the bpf programs names are now visible in Inspektor Gadget's top-ebpf tool:
|
Wow this is super useful, thank you! |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area libscap-engine-bpf
Does this PR require a change in the driver versions?
What this PR does / why we need it:
This patch helps to distinguish Falco's bpf programs in bpftool or in kubectl gadget top ebpf.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: