bpf: set maximum number of attached progs to 64 for a single perf tp

cgropu+bpf prog array has a maximum number of 64 programs.
Let us apply the same limit here.

Fixes: e87c6bc385 ("bpf: permit multiple bpf attachments for a single perf event")
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
Yonghong Song
2017-11-30 13:47:54 -08:00
committed by Daniel Borkmann
parent 2b27941956
commit c8c088ba0e
2 changed files with 10 additions and 1 deletions

View File

@@ -1447,7 +1447,8 @@ int bpf_prog_array_length(struct bpf_prog_array __rcu *progs)
rcu_read_lock();
prog = rcu_dereference(progs)->progs;
for (; *prog; prog++)
cnt++;
if (*prog != &dummy_bpf_prog.prog)
cnt++;
rcu_read_unlock();
return cnt;
}