diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2015-10-23 03:10:14 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-27 07:49:26 +0300 |
commit | 62544ce8e01c1879d420ba309f7f319d24c0f4e6 (patch) | |
tree | 394d2f12e6a065b53b3d71bd89ea4b931ce3ec71 /include/linux/bpf.h | |
parent | 8b7c94e3478dbb0296293b43a974c3561d01e9fb (diff) | |
download | linux-62544ce8e01c1879d420ba309f7f319d24c0f4e6.tar.xz |
bpf: fix bpf_perf_event_read() helper
Fix safety checks for bpf_perf_event_read():
- only non-inherited events can be added to perf_event_array map
(do this check statically at map insertion time)
- dynamically check that event is local and !pmu->count
Otherwise buggy bpf program can cause kernel splat.
Also fix error path after perf_event_attrs()
and remove redundant 'extern'.
Fixes: 35578d798400 ("bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r-- | include/linux/bpf.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index e3a51b74e275..75718fa28260 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -194,7 +194,6 @@ extern const struct bpf_func_proto bpf_map_lookup_elem_proto; extern const struct bpf_func_proto bpf_map_update_elem_proto; extern const struct bpf_func_proto bpf_map_delete_elem_proto; -extern const struct bpf_func_proto bpf_perf_event_read_proto; extern const struct bpf_func_proto bpf_get_prandom_u32_proto; extern const struct bpf_func_proto bpf_get_smp_processor_id_proto; extern const struct bpf_func_proto bpf_tail_call_proto; |