Open agentzh opened 8 months ago
Another issue here is why it still went forward to attach to the uprobe when it failed to find the base address of the target program? Missing proper error handling here?
OK, found that it is because the target process for ./a.out
is spawned by a parent bash
process, and that both of them have libbpftime-agent.so
preloaded. If I get rid of the parent bash process, then the errors are gone:
[2024-01-28 00:53:06][info][707271] Created uprobe/uretprobe perf event handler, module name /500g-a/git/ebpf-plus/libbpf/uprobes/a.out, offset 1106
[2024-01-28 00:53:06.163] [info] [agent.cpp:66] Entering bpftime agent
[2024-01-28 00:53:06.163] [info] [bpftime_shm_internal.cpp:618] Global shm constructed. shm_open_type 1 for bpftime_maps_shm
[2024-01-28 00:53:06.164] [info] [agent.cpp:81] Initializing agent..
[2024-01-28 00:53:06][info][707276] Initializing llvm
[2024-01-28 00:53:06][info][707276] Executable path: /500g-a/git/ebpf-plus/libbpf/uprobes/a.out
[2024-01-28 00:53:06][info][707276] Attached 1 uprobe programs to function 401106
[2024-01-28 00:53:06][info][707276] Attach successfully
Still, this special case is worth fixing. I think for irrelevant processes with the bpftime agent preloaded, they should just be silently ignored.
I'm getting errors with LLVM JIT mode of bpftime on Fedora Linux x86_64:
Note the lines containing
[error]
in the output:The
a.out
is a simple ELF executable which is not a PIE:And it is built from the following C source file
a.c
:And the command to build it is like this:
Using other tools can easily find its base address is 0x400000. Nothing unusual.
How to debug and workaround this issue?