eunomia-bpf / bpftime

Userspace eBPF runtime for fast Uprobe & Syscall hook & Extensions with LLVM JIT
https://eunomia.dev/bpftime/
MIT License
687 stars 68 forks source link

[FEATURE] Make examples depending on libbpf able to build on macos #306

Open hp77-creator opened 3 weeks ago

hp77-creator commented 3 weeks ago

Is your feature request related to a problem? Please describe.

Right now, libbpf doesn't compile on macOS because of some headers which are not present. This issue is to add those headers or maybe their alternatives to the project and make bpftime work with libbpf on macOS. **Describe the solution you'd like**

libbpf should work with bpftime on macOS. identify all the headers and syscalls that are being used and replace it with hooks to make them work.

Provide usage examples

After this feature is incoporated, bpftime will be able to work on macOS without LIBBPF flag disabled.

hp77-creator commented 3 weeks ago

relates to #145

Officeyutong commented 3 weeks ago

A better title: Make examples depending on libbpf able to build on macos

libbpf itself can't work on macos obviously, but if we may get it able to be built on macos by providing mocked implementation of linux-specified functions that libbpf needs. These mocked implementations could be just empty functions. They don't need to really work, since they'll be overriden by function implementations provided by syscall-server. We provide these functions just to trick the linker.

If we were able to build examples of bpftime on macos, we'll be able to test them on macos with bpftime.

hp77-creator commented 6 days ago

@Officeyutong , I am planning to close this one before frida, working on this atm.

Officeyutong commented 6 days ago

@Officeyutong , I am planning to close this one before frida, working on this atm.

ok