eunomia-bpf / bpftime

Userspace eBPF runtime for Observability, Network & General Extensions Framework
https://eunomia.dev/bpftime/
MIT License
834 stars 78 forks source link

[need help] Failed to attach uprobes ,getting errors #326

Closed nalreddy closed 3 months ago

nalreddy commented 3 months ago

Trying to attach uprobes to application : https://github.com/ls1mardyn/ls1-mardyn

I am getting following errors at server side : Could you please let me know what is the issue , when does it happen. do I need to increase any limits here.

FYI : I have increased fd limit in bpftime code and increased system ulimit to large value like 50k.

-const size_t DEFAULT_MAX_FD = 1024 6; +const size_t DEFAULT_MAX_FD = 4024 6;

2024-08-12 08:13:43][info][3854422] Created uprobe/uretprobe perf event handler, module name /home/user/data/app/ls1-mardyn/build_aocc/src/MarDyn, offset 189c30 [2024-08-12 08:13:43][error][3854422] Unable to find an available id: -1 [2024-08-12 08:13:43][warning][3854422] Failed to call mocked ioctl PERF_EVENT_IOC_SET_BPF: -28 [2024-08-12 08:13:43][warning][3854422] Calling original ioctl: 1023 1074013192 5 libbpf: prog 'uprobe_handler': failed to attach to perf_event FD 1023: Inappropriate ioctl for device libbpf: prog 'uprobe_handler': failed to attach to uprobe '/home/user/data/app/ls1-mardyn/build_aocc/src/MarDyn:0x189c30': Inappropriate ioctl for device Warning : Failed to attach uprobe to binary /home/user/data/app/ls1-mardyn/build_aocc/src/MarDyn function name MettDeamon::calcDeltaYbyDensity offset 189c30 Error Inappropriate ioctl for device. [2024-08-12 08:13:43][info][3854422] Created uprobe/uretprobe perf event handler, module name /home/satya/data/app/ls1-mardyn/build_aocc/src/MarDyn, offset 18f8b0 [2024-08-12 08:13:43][error][3854422] Unable to find an available id: -1 [2024-08-12 08:13:43][warning][3854422] Failed to call mocked ioctl PERF_EVENT_IOC_SET_BPF: -28 [2024-08-12 08:13:43][warning][3854422] Calling original ioctl: 1023 1074013192 5 libbpf: prog 'uprobe_handler': failed to attach to perf_event FD 1023: Inappropriate ioctl for device libbpf: prog 'uprobe_handler': failed to attach to uprobe '/home/user/data/app/ls1-mardyn/build_aocc/src/MarDyn:0x18f8b0': Inappropriate ioctl for device Warning : Failed to attach uprobe to binary /home/user/data/app/ls1-mardyn/build_aocc/src/MarDyn function name std::vector<unsigned long, std::allocator >::operator= offset 18f8b0 Error Inappropriate ioctl for device.

bpftime : latest code

Linux :
uname -r 6.5.0

cat /etc/os-release PRETTY_NAME="Ubuntu 23.04" NAME="Ubuntu" VERSION_ID="23.04" VERSION="23.04 (Lunar Lobster)" VERSION_CODENAME=lunar ID=ubuntu ID_LIKE=debian

System details ulimit -a real-time non-blocking time (microseconds, -R) unlimited core file size (blocks, -c) 1000000 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 2058801 max locked memory (kbytes, -l) 66017440 max memory size (kbytes, -m) unlimited open files (-n) 90000 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 2058801 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

nalreddy commented 3 months ago

sudo LD_PRELOAD=/home/user/data/bpftime/build/runtime/syscall-server/libbpftime-syscall-server.so ./bpftracer / ./MarDyn

bpftracer is bpf program gets offsets to functions of application and try to attach uprobes.

nalreddy commented 3 months ago

sorry for false alarm, running the command as sudo , forget to increase limit for the same . It worked after increasing ulimit