Missing ref_ctr_offset arg in bpf_attach_uprobe python def
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
`bpf_attach_uprobe` is defined as:
https://github.com/iovisor/bcc/blob/db5b63ff876d3346021871e2189a354bfc6d510e/src/cc/libbpf.h#L111-L113
but its python definition seems to be missing the last arg (`uint32_t ref_ctr_offset`):
https://github.com/iovisor/bcc/blob/db5b63ff876d3346021871e2189a354bfc6d510e/src/python/bcc/libbcc.py#L113-L115
It seems this results in garbage being passed to the C call when attaching probes from
https://github.com/iovisor/bcc/blob/db5b63ff876d3346021871e2189a354bfc6d510e/src/python/bcc/__init__.py#L1425
https://github.com/iovisor/bcc/blob/db5b63ff876d3346021871e2189a354bfc6d510e/src/python/bcc/__init__.py#L1457
I've noticed attaching a uprobe/uretprobe pair would fail for no apparent reason after minor changes in the python code. It seems `bpf_attach_uprobe` can take any value for `ref_ctr_offset` and it works fine as long as the value is the same for the same probe location.
What would be the appropriate fix for this ? Always passing 0 to `ref_ctr_offset` ?
Contributor guide
No contributing guide indexed for this repository
Research direction
Compare the bpf_attach_uprobe declaration in src/cc/libbpf.h with its Python binding in src/python/bcc/libbcc.py, then trace the calls in src/python/bcc/__init__.py at the referenced locations. Check existing tests for uprobe and uretprobe attachment behavior. Done means the binding and C signature agree and attaching the probe pair no longer receives an unintended argument value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- operating-systems, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100