bpfman / bpfman/bpfman-operator
add platform prefix to kprobe symbol if missing
- Dominant language
- Go
- Stars
- 38
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
Cilium has a nice feature in their [`link` package](https://pkg.go.dev/github.com/cilium/ebpf@v0.16.0/link#Kprobe) where:
> If attaching to symbol fails, automatically retries with the running platform's syscall prefix (e.g. __x64_) to support attaching to syscalls in a portable fashion.
It catches any `file not found` errors and then it uses [`internal.PlatformPrefix` ](https://github.com/cilium/ebpf/blob/main/internal/linux/platform.go#L12)(from the [internal package](https://pkg.go.dev/github.com/cilium/ebpf/internal)) to prepend the right prefix to the function symbol to then try again: https://github.com/cilium/ebpf/blob/v0.16.0/link/kprobe.go#L171C1-L176C3
I'm opening this issue here since I was using bpfman on k8s and my `Kprobeprogram` couldn't be loaded successfully (I couldn't figure out the error messages, until I realized the error was the symbol I was trying to attach the kprobe to was missing the `__x64_` prefix -- which I wasn't really paying to much attention to since I was using `link.Kprobe`). However, I'm not sure if this should go in the [bfpman](https://github.com/bfpman/bpfman) repo instead.
I don't know much Rust myself, but I might be able to put something together for this small convenience function (although, if there's a place where we can do this in Go I can probably help better!)
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect the KprobeProgram loading and attach entry point in bpfman-operator, then compare its behavior with Cilium's link/kprobe.go and internal/linux/platform.go. Done means a missing-symbol file-not-found failure retries with the running platform prefix, with coverage for the prefixed path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, linux
- Domain
- devops, operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100