2017-03-10 13:50:53

by Dorau, Lukasz

[permalink] [raw]
Subject: Cannot attach BPF to tracepoints

Hi,

I cannot attach BPF to tracepoints.

I used bcc's (https://github.com/iovisor/bcc) trace.py tool:
https://github.com/iovisor/bcc/blob/master/tools/trace.py
to test this issue:

# /usr/share/bcc/tools/trace t:syscalls:sys_enter_open
ioctl(PERF_EVENT_IOC_SET_BPF): Invalid argument
Failed to attach BPF to tracepoint

# /usr/share/bcc/tools/trace t:syscalls:sys_exit_open
ioctl(PERF_EVENT_IOC_SET_BPF): Invalid argument
Failed to attach BPF to tracepoint

However it is possible to attach BPF to raw tracepoints:
# /usr/share/bcc/tools/trace t:raw_syscalls:sys_enter
# /usr/share/bcc/tools/trace t:raw_syscalls:sys_exit

and to kprobes:
# /usr/share/bcc/tools/trace 'sys_open "%s", arg1'
# /usr/share/bcc/tools/trace 'r::sys_open "%s", arg1'

Can it be a bug in BPF code?

Regards,
Lukasz