trace/bpf: remove helper bpf_perf_prog_read_value from tracepoint type programs
authorYonghong Song <yhs@fb.com>
Tue, 20 Mar 2018 18:19:17 +0000 (11:19 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 20 Mar 2018 22:08:52 +0000 (23:08 +0100)
commitf005afede992e265bb98534b86912bb669ccd0d2
treec77bf0158253ff4fbd927bad98dee46c1b6e273b
parent52fda36d63bfc8c8e8ae5eda8eb5ac6f52cd67ed
trace/bpf: remove helper bpf_perf_prog_read_value from tracepoint type programs

Commit 4bebdc7a85aa ("bpf: add helper bpf_perf_prog_read_value")
added helper bpf_perf_prog_read_value so that perf_event type program
can read event counter and enabled/running time.
This commit, however, introduced a bug which allows this helper
for tracepoint type programs. This is incorrect as bpf_perf_prog_read_value
needs to access perf_event through its bpf_perf_event_data_kern type context,
which is not available for tracepoint type program.

This patch fixed the issue by separating bpf_func_proto between tracepoint
and perf_event type programs and removed bpf_perf_prog_read_value
from tracepoint func prototype.

Fixes: 4bebdc7a85aa ("bpf: add helper bpf_perf_prog_read_value")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/trace/bpf_trace.c