]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fail PERF_EVENT_IOC_SET_BPF when bpf_get_[stack|stackid] cannot work
authorSong Liu <songliubraving@fb.com>
Thu, 23 Jul 2020 18:06:45 +0000 (11:06 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Jul 2020 03:16:34 +0000 (20:16 -0700)
commit32b588f0a47e15b187acd4a14e69862da831e211
tree25c9829e8b83c8066b286c414821fac40a4e3c04
parent02387378347a710a45e570966a7d6641f688c80a
bpf: Fail PERF_EVENT_IOC_SET_BPF when bpf_get_[stack|stackid] cannot work

bpf_get_[stack|stackid] on perf_events with precise_ip uses callchain
attached to perf_sample_data. If this callchain is not presented, do not
allow attaching BPF program that calls bpf_get_[stack|stackid] to this
event.

In the error case, -EPROTO is returned so that libbpf can identify this
error and print proper hint message.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200723180648.1429892-3-songliubraving@fb.com
include/linux/filter.h
kernel/bpf/verifier.c
kernel/events/core.c