USDT probes with arguments can't be attached to the same BPF C function
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
uprobes don't seem to have this limitation. Is this a USDT bug or is this behaviour by design?
Consider a C/C++ application with these USDT probes:
```
DTRACE_PROBE(test, probe_noarg_0);
DTRACE_PROBE(test, probe_noarg_1);
DTRACE_PROBE1(test, probe_arg_0, "myarg0");
DTRACE_PROBE1(test, probe_arg_1, "myarg1");
```
Attaching the same BPF C function probe_func to two distinct USDT probes that have no arguments works:
```
u.enable_probe(probe="probe_noarg_0", fn_name="probe_func")
u.enable_probe(probe="probe_noarg_1", fn_name="probe_func")
```
However, attaching the same BPF C function probe_func to two distinct USDT probes **that have an argument** errors out with `/virtual/main.c:7:28: error: redefinition of '_bpf_readarg_probe_func_1'`.
```
u.enable_probe(probe="probe_arg_0", fn_name="probe_func")
u.enable_probe(probe="probe_arg_1", fn_name="probe_func")
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the C/C++ USDT probes and the two u.enable_probe calls shown in the report. Inspect the generated /virtual/main.c around line 7, where _bpf_readarg_probe_func_1 is redefined. Done means determining whether this is intended behavior or allowing the shared function to attach to both argument-bearing probes without that redefinition error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, python
- Domain
- devtools, operating-systems, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100