]> git.baikalelectronics.ru Git - kernel.git/commit
perf/hw_breakpoint: Annotate tsk->perf_event_mutex vs ctx->mutex
authorPeter Zijlstra <peterz@infradead.org>
Tue, 4 Oct 2022 10:20:39 +0000 (12:20 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 4 Oct 2022 11:32:09 +0000 (13:32 +0200)
commite265016d61fe34b5f890ba1fe8a8f1757858c07d
tree91133f2c55e578b0c8398f2e3b4c7964c1746c7a
parentedc468582cf1170dbc41e2062cef587231dd3469
perf/hw_breakpoint: Annotate tsk->perf_event_mutex vs ctx->mutex

Perf fuzzer gifted a lockdep splat:

  perf_event_init_context()
    mutex_lock(parent_ctx->mutex); (B)
    inherit_task_group()
      inherit_group()
        inherit_event()
          perf_event_alloc()
            perf_try_init_event() := hw_breakpoint_event_init()
              register_perf_hw_breakpoint()
                mutex_lock(child->perf_event_mutex); (A)

Which is against the normal (documented) order. Now, this is a false
positive in that child is not published yet, but also inherited events
never end up on ->perf_event_list.

Annotate this one away.

Fixes: 46b18b84940e ("perf/hw_breakpoint: Reduce contention with large number of tasks")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
kernel/events/hw_breakpoint.c