perf/aux: Fix AUX buffer serialization
authorPeter Zijlstra <peterz@infradead.org>
Mon, 2 Sep 2024 08:14:24 +0000 (10:14 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 4 Sep 2024 16:22:56 +0000 (18:22 +0200)
commit2ab9d830262c132ab5db2f571003d80850d56b2a
tree0bd610077e7431521aa80a29feb6128934c88eea
parente240b0fde52f33670d1336697c22d90a4fe33c84
perf/aux: Fix AUX buffer serialization

Ole reported that event->mmap_mutex is strictly insufficient to
serialize the AUX buffer, add a per RB mutex to fully serialize it.

Note that in the lock order comment the perf_event::mmap_mutex order
was already wrong, that is, it nesting under mmap_lock is not new with
this patch.

Fixes: 45bfb2e50471 ("perf: Add AUX area to ring buffer for raw data streams")
Reported-by: Ole <ole@binarygecko.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c
kernel/events/internal.h
kernel/events/ring_buffer.c