Yonghong Song cf5f5cea27 bpf: add support for sys_enter_* and sys_exit_* tracepoints
Currently, bpf programs cannot be attached to sys_enter_* and sys_exit_*
style tracepoints. The iovisor/bcc issue #748
(https://github.com/iovisor/bcc/issues/748) documents this issue.
For example, if you try to attach a bpf program to tracepoints
syscalls/sys_enter_newfstat, you will get the following error:
   # ./tools/trace.py t:syscalls:sys_enter_newfstat
   Ioctl(PERF_EVENT_IOC_SET_BPF): Invalid argument
   Failed to attach BPF to tracepoint

The main reason is that syscalls/sys_enter_* and syscalls/sys_exit_*
tracepoints are treated differently from other tracepoints and there
is no bpf hook to it.

This patch adds bpf support for these syscalls tracepoints by
  . permitting bpf attachment in ioctl PERF_EVENT_IOC_SET_BPF
  . calling bpf programs in perf_syscall_enter and perf_syscall_exit

The legality of bpf program ctx access is also checked.
Function trace_event_get_offsets returns correct max offset for each
specific syscall tracepoint, which is compared against the maximum offset
access in bpf program.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-07 14:09:48 -07:00
..
2017-07-09 18:48:37 -07:00
2017-07-03 20:55:59 -07:00
2017-07-11 09:55:47 -07:00
2017-07-13 12:07:44 -07:00
2017-08-03 21:37:30 -07:00
2017-06-29 17:34:57 +02:00
2017-07-22 08:55:16 -07:00
2017-07-03 17:00:59 -06:00
2017-07-06 16:24:33 -07:00
2017-07-10 10:51:53 -07:00
2017-07-03 16:56:28 -06:00
2017-06-22 15:43:47 +01:00
2017-07-07 09:44:06 -07:00
2017-07-07 09:49:24 +10:00
2017-07-07 20:09:10 -04:00
2017-06-21 14:37:12 -04:00
2017-07-10 16:32:34 -07:00
2017-07-10 10:51:53 -07:00
2017-07-10 13:41:04 -04:00
2017-07-07 18:39:15 -07:00
2017-07-13 16:00:15 -04:00
2017-07-12 16:26:02 -07:00
2017-07-06 11:30:07 -04:00
2017-07-25 18:05:25 +02:00
2017-07-08 15:51:57 -07:00
2017-08-06 20:55:29 -07:00
2017-08-06 20:55:29 -07:00
2017-07-03 15:12:52 -07:00
2017-06-29 10:48:57 +01:00
2017-07-12 23:11:23 +02:00
2017-07-06 16:24:30 -07:00
2017-08-03 21:37:30 -07:00
2017-08-03 21:37:29 -07:00
2017-07-24 17:50:37 +02:00