Skip to content

feat: support tracepoint-based ebpf programs #1190

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Godones
Copy link
Contributor

@Godones Godones commented Jun 4, 2025

支持基于tracepoint的eBPF程序

@github-actions github-actions bot added the enhancement New feature or request label Jun 4, 2025
Signed-off-by: Godones <[email protected]>
@fslongjin fslongjin requested a review from Copilot June 4, 2025 11:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds support for tracepoint-based eBPF programs across both user and kernel components. Key changes include:

  • Introducing no_std library targets for eBPF components in the mytrace-ebpf and mytrace-common crates.
  • Enhancing kernel tracepoint modules with new callback registration, raw callback support, and updated format functions for trace events.
  • Updating workspace configurations, build scripts, and Makefiles to integrate these new capabilities.

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
user/apps/test_tracepoint/mytrace-ebpf/src/lib.rs Added no_std marker and a minimal library file for eBPF programs.
user/apps/test_tracepoint/mytrace-ebpf/build.rs Introduced a build script to trigger rebuilds when the mtime of bpf-linker changes.
user/apps/test_tracepoint/mytrace-ebpf/Cargo.toml Configured dependencies for the mytrace-ebpf crate.
user/apps/test_tracepoint/mytrace-common/src/lib.rs Added no_std marker to support embedded environments.
user/apps/test_tracepoint/mytrace-common/Cargo.toml Declared dependencies and enabled workspace features for common code.
user/apps/test_tracepoint/README.md Updated documentation with build prerequisites and instructions.
user/apps/test_tracepoint/Makefile Provided targets for building, testing, and installing the project.
user/apps/test_tracepoint/Cargo.toml Set up workspace members and shared dependency versions.
kernel/src/tracepoint/* Modified tracepoint modules for improved callback handling and safer format function usage.
kernel/src/perf/* Added tracepoint perf integration and adjusted perf event configuration.
kernel/src/filesystem/vfs/syscall/open_utils.rs Added trace event instrumentation for sys_openat.
kernel/src/debug/tracing/mod.rs Updated tracing initialization with lazy file creation.
kernel/src/bpf/helper/* Introduced a helper for probe_read_user_str and updated bpf helper function setup.
Comments suppressed due to low confidence (1)

kernel/src/tracepoint/basic_macro.rs:151

  • For packed structures, consider using core::ptr::read_unaligned to safely retrieve the Entry without risking undefined behavior due to potential misalignment.
let $tp_ident = unsafe { &*(buf.as_ptr() as *const Entry) };

@fslongjin
Copy link
Member

hello,麻烦补充一下文档,以及解决一下这几个warning~
image

Copy link
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

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

image
貌似ctrl+C无法退出。可能是内核有的地方,循环读取东西的时候,没有检测是否有信号等待处理?

@fslongjin
Copy link
Member

image 貌似ctrl+C无法退出。可能是内核有的地方,循环读取东西的时候,没有检测是否有信号等待处理?

#1200

我发现master分支也是这样。麻烦看看~ @sparkzky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants