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

Dynamic addition of kprobe and tracepoint #44

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

ZHaoXiangyuA
Copy link

@ZHaoXiangyuA ZHaoXiangyuA commented Jul 1, 2024

Dynamically enable and disable kprobe and tracepoint events using file descriptors (fd).
Description
Utilize the file descriptors (fd) generated when loading BPF programs into the kernel and hooking them to control the enabling of kprobe and tracepoint events dynamically.
Why add a new way to implement event toggling?
1.In an eBPF program, complete shutdown can be dynamically achieved without the need for logical checks.
2.To toggle new events via BPF maps, developers must be familiar not only with agent-lib code but also with Kindling's CGO code to implement the necessary functionality. This involves calling map functions for kernel interaction in agent-libs and knowing the event type for shutdown. While macro definitions hide the logical checks in the eBPF program, reducing the need for manual developer intervention, it adds complexity to code reading and may not completely close events. Using file descriptors (fd) to control event toggling only requires switching based on the mounted eBPF program's name, eliminating the need to pass the tracepoint type for closure. This allows Kindling to develop a universal interface where specifying the event name is sufficient for complete shutdown of new events, facilitating rapid implementation of toggling functionalities by specifying kprobe and tracepoint names.

@@ -1324,6 +1375,93 @@ int32_t scap_bpf_close(scap_t *handle)
return SCAP_SUCCESS;
}

static int32_t scap_bpf_handle_kt_mask( scap_t *handle, uint32_t op, uint32_t kt_index)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are preparing to add uprobe as a new program type in some other plans. Can we abstract k_t to another level. #37

Copy link

Choose a reason for hiding this comment

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

uprobe function is not merge yet , now we can merge first

@J-lena J-lena merged commit cfb3275 into KindlingProject:kindling-dev Oct 12, 2024
2 checks passed
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.

3 participants