]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, perf: delay release of BPF prog after grace period
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 27 Jun 2016 19:38:11 +0000 (21:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Jun 2016 09:42:55 +0000 (05:42 -0400)
commit1e20fab9905220c97f017afeb29b32621e6a2e94
tree0f6deeff3c087009986f95158f27e1d2bd9ae549
parentaba292aafbc216a79ce5014a1520e8dbd72c68f4
bpf, perf: delay release of BPF prog after grace period

Commit b346be8a8bc5 ("perf: Fix race in BPF program unregister") moved
destruction of BPF program from free_event_rcu() callback to __free_event(),
which is problematic if used with tail calls: if prog A is attached as
trace event directly, but at the same time present in a tail call map used
by another trace event program elsewhere, then we need to delay destruction
via RCU grace period since it can still be in use by the program doing the
tail call (the prog first needs to be dropped from the tail call map, then
trace event with prog A attached destroyed, so we get immediate destruction).

Fixes: b346be8a8bc5 ("perf: Fix race in BPF program unregister")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Jann Horn <jann@thejh.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf.h
kernel/events/core.c