[go: up one dir, main page]

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

Rewrite eBPF profiler in Rust #377

Merged
merged 12 commits into from
May 15, 2022
Merged

Conversation

kakkoyun
Copy link
Member
@kakkoyun kakkoyun commented Apr 26, 2022

Signed-off-by: Kemal Akkoyun kakkoyun@gmail.com

We use C for writing eBPF programs that live in kernel-space in Parca Agent. The act of writing C programs in an error-prone process. And the language itself has lots of ways to shoot oneself in the foot. Even though the eBPF verifier makes life a lot easier, it is still possible to write unsafe programs. Or when you make a mistake and the verifier doesn’t give the green light to the program, it is hard to pinpoint the mistakes that you made that can be preventable with simple compile-time checks (memory overflows, type-checking). The goal is to use Rust to write eBPF programs to provide more compile-time checks for safety and security.

@yeya24
Copy link
Contributor
yeya24 commented Apr 27, 2022

Just curious any reason behind this? Is the golang agent not performant enough or it is simply because rust is cooler?

@kakkoyun
Copy link
Member Author

@yeya24 Hahaha, none of the above. I have updated the description for you. The gist of it, we would like to try Rust as an alternative to the C program we us in kernel-space. The idea is to guarantee more safety by preventing mistakes.

@yeya24
Copy link
Contributor
yeya24 commented Apr 27, 2022

Got it. I made a mistake and you are just rewriting the kernel side ebpf collector. This makes sense to me. Thanks for the explanation.

@kakkoyun
Copy link
Member Author

cc @dave-tucker

@kakkoyun kakkoyun force-pushed the rust_in_action branch 8 times, most recently from c2e6d38 to 8079e57 Compare April 28, 2022 06:36
@kakkoyun kakkoyun changed the title WIP: Rewrite eBPF profiler in Rust [Experiment] WIP: Rewrite eBPF profiler in Rust Apr 28, 2022
@kakkoyun kakkoyun added the experiment Experimental features or Proof of Concepts label Apr 28, 2022
@kakkoyun kakkoyun changed the title [Experiment] WIP: Rewrite eBPF profiler in Rust [Experiment] Rewrite eBPF profiler in Rust May 5, 2022
@kakkoyun kakkoyun changed the title [Experiment] Rewrite eBPF profiler in Rust Rewrite eBPF profiler in Rust May 5, 2022
@kakkoyun kakkoyun marked this pull request as ready for review May 5, 2022 15:00
@kakkoyun
Copy link
Member Author
kakkoyun commented May 5, 2022

PTAL @v-thakkar @Sylfrena @javierhonduco

@kakkoyun kakkoyun marked this pull request as draft May 6, 2022 06:00
@kakkoyun kakkoyun marked this pull request as ready for review May 11, 2022 10:48
Copy link
Contributor
@javierhonduco javierhonduco left a comment

Choose a reason for hiding this comment

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

LGTM overall!! Currently testing it on my Fedora arm64 box, will follow-up as soon as I get some profiles

.github/workflows/build.yml Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
Dockerfile.dev Show resolved Hide resolved
bpf/cpu-profiler/src/main.rs Outdated Show resolved Hide resolved
bpf/cpu-profiler/src/main.rs Outdated Show resolved Hide resolved
bpf/cpu-profiler/src/main.rs Outdated Show resolved Hide resolved
bpf/cpu-profiler/src/main.rs Outdated Show resolved Hide resolved
bpf/Makefile Outdated Show resolved Hide resolved
@kakkoyun kakkoyun added this to the v0.9.0 milestone May 13, 2022
bpf/cpu-profiler/src/main.rs Outdated Show resolved Hide resolved
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Remove c toolchain

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
@kakkoyun kakkoyun merged commit ebd9e30 into parca-dev:main May 15, 2022
@kakkoyun kakkoyun deleted the rust_in_action branch May 15, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment Experimental features or Proof of Concepts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants