weaver
weaver copied to clipboard
[bug] `make` fail because encounter “not enough arguments in call to (_C2func_bpf_attach_uprobe)”
Describe the bug When I wanted to make this project according to the guidance of README, I encountered the following error,
Environment
- kernel version: linux 5.10.134-14.1.al8.x86_64
- linux release: centOS 8.x
How to fix
I refer to the current code of gobpf
, I think a parameter should be added at the end of line 261 of vendor/github.com/iovisor/gobpf/bcc/module.go
like this:
// - res, err := C.bpf_attach_uprobe(C.int(fd), attachType, evNameCS, binaryPathCS, (C.uint64_t)(addr), (C.pid_t)(pid))
res, err := C.bpf_attach_uprobe(C.int(fd), attachType, evNameCS, binaryPathCS, (C.uint64_t)(addr), (C.pid_t)(pid), 0)
@ZhaoHaoRu Thanks for reporting this, I haven't been working on this project for a couple of years but this is something i'm aware of. I'm currently building functionality just like weaver for Datadog's product offering.
You're correct that there's a missing parameter, it's because the API was broken as a new parameter was added to this function in gobpf
since I originally developed weaver. The fix is to add usage of the new parameter, which I think is just a flag that you can pass 0. If you want to open a PR i'd happily test it and merge.
However, since you're a student and I assume are checking out this project for learning purposes, I would recommend checking out more modern libraries to use for bpf such as libbpf (which is for C applications) or cilium/ebpf for Go which doesn't use bcc. Happy to answer any questions you have.
@grantseltzer I open a pull request to fix the bug, can you see it now?
I am working on a project with cilium/ebpf, but I think your project is a good beginning for me to learn uprobe with golang. Thank you for your advise!