linux_dsm_epyc7002/kernel/events
Yonghong Song ec9dd352d5 bpf: one perf event close won't free bpf program attached by another perf event
This patch fixes a bug exhibited by the following scenario:
  1. fd1 = perf_event_open with attr.config = ID1
  2. attach bpf program prog1 to fd1
  3. fd2 = perf_event_open with attr.config = ID1
     <this will be successful>
  4. user program closes fd2 and prog1 is detached from the tracepoint.
  5. user program with fd1 does not work properly as tracepoint
     no output any more.

The issue happens at step 4. Multiple perf_event_open can be called
successfully, but only one bpf prog pointer in the tp_event. In the
current logic, any fd release for the same tp_event will free
the tp_event->prog.

The fix is to free tp_event->prog only when the closing fd
corresponds to the one which registered the program.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-20 14:10:29 -07:00
..
callchain.c perf/callchain: Force USER_DS when invoking perf_callchain_user() 2017-05-10 07:54:00 +02:00
core.c bpf: one perf event close won't free bpf program attached by another perf event 2017-09-20 14:10:29 -07:00
hw_breakpoint.c perf: Collapse and fix event_function_call() users 2016-01-21 18:54:24 +01:00
internal.h tracing, perf: Adjust code layout in get_recursion_context() 2017-08-25 11:04:18 +02:00
Makefile ftrace: allow architectures to specify ftrace compile options 2015-01-29 09:19:19 +01:00
ring_buffer.c perf/aux: Ensure aux_wakeup represents most recent wakeup index 2017-08-25 11:04:16 +02:00
uprobes.c mm, uprobes: fix multiple free of ->uprobes_state.xol_area 2017-08-31 16:33:15 -07:00