Skip to content

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.

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 harmonycloud:kindling-dev Oct 12, 2024
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