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

[bug] make fail because encounter “not enough arguments in call to (_C2func_bpf_attach_uprobe)” #55

Open
ZhaoHaoRu opened this issue Aug 16, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ZhaoHaoRu
Copy link

Describe the bug
When I wanted to make this project according to the guidance of README, I encountered the following error,

image

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 ZhaoHaoRu added the bug Something isn't working label Aug 16, 2023
@grantseltzer
Copy link
Owner

@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.

@ZhaoHaoRu
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants