iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

when I use bpf_attach_tracepoint to attach a uprobe, it cames out error as "perf_event_open(/sys/kernel/tracing/events/uprobes/dmabufAlloc/id): Interrupted system call" #4880

Closed EricHChz closed 8 months ago

EricHChz commented 8 months ago

in my Android phone, i add a uprobe as

echo "p:uprobes/dmabufAlloc /apex/com.android.vndk.v34/lib64/libdmabufheap.so:0x000000000000e970 fd=%x0 size=%x2" > /sys/kernel/debug/tracing/uprobe_events

and then ,i write my bpfprog and user client to attach it. in my client program,

    static constexpr const char tp_prog_path[] = "/sys/fs/bpf/prog_bpfHookMem_uprobe_dmabufAlloc";
    static constexpr const char tp_map_path[] = "/sys/fs/bpf/map_bpfHookMem_dmabufAlloc_size";
    int mProgFd = android::bpf::retrieveProgram(tp_prog_path);

    while(bpf_attach_tracepoint(mProgFd, "uprobes", "dmabufAlloc") < 0) {
        sleep(1);
        printf("Failed to attach bpf program to fd:%d error [%d(%s)]\n", mProgFd,
                      errno, strerror(errno));
    }

it cames out an error as

perf_event_open(/sys/kernel/tracing/events/uprobes/dmabufAlloc/id): Interrupted system call
perf_event_open(/sys/kernel/debug/tracing/events/uprobes/dmabufAlloc/id): Interrupted system call

when i use the same way to attach a tracepoint, it works fine, so what is the proble with uprobes and how can i resolve it?

EricHChz commented 8 months ago

sry, i made wrong code.