linux-stable/kernel/trace
Steven Rostedt (Google) 321dca2afd ring-buffer: Fix memory leak of free page
commit 17d8017581 upstream.

Reading the ring buffer does a swap of a sub-buffer within the ring buffer
with a empty sub-buffer. This allows the reader to have full access to the
content of the sub-buffer that was swapped out without having to worry
about contention with the writer.

The readers call ring_buffer_alloc_read_page() to allocate a page that
will be used to swap with the ring buffer. When the code is finished with
the reader page, it calls ring_buffer_free_read_page(). Instead of freeing
the page, it stores it as a spare. Then next call to
ring_buffer_alloc_read_page() will return this spare instead of calling
into the memory management system to allocate a new page.

Unfortunately, on freeing of the ring buffer, this spare page is not
freed, and causes a memory leak.

Link: https://lore.kernel.org/linux-trace-kernel/20231210221250.7b9cc83c@rorschach.local.home

Cc: stable@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: 73a757e631 ("ring-buffer: Return reader page back into existing ring buffer")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:32:38 +01:00
..
Kconfig Stop the ad-hoc games with -Wno-maybe-initialized 2020-05-20 08:17:10 +02:00
Makefile
blktrace.c blktrace: Fix output non-blktrace event when blk_classic option enabled 2023-01-18 09:26:18 +01:00
bpf_trace.c
ftrace.c ftrace: Fix invalid address access in lookup_rec() when index is 0 2023-03-22 13:26:16 +01:00
power-traces.c
ring_buffer.c ring-buffer: Fix memory leak of free page 2023-12-20 15:32:38 +01:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c tracing: Fix a possible race when disabling buffered events 2023-12-13 16:46:16 +01:00
trace.h tracing: Make sure trace_printk() can output as soon as it can be used 2023-02-06 07:46:31 +01:00
trace_benchmark.c
trace_benchmark.h
trace_branch.c
trace_clock.c tracing: Do no increment trace_clock_global() by one 2021-06-30 08:48:53 -04:00
trace_entries.h tracing: Set kernel_stack's caller size properly 2020-10-01 13:12:32 +02:00
trace_event_perf.c
trace_events.c tracing: relax trace_event_eval_update() execution with cond_resched() 2023-10-25 11:13:32 +02:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c tracing: Do not reference char * as a string in histograms 2021-07-20 16:17:48 +02:00
trace_events_trigger.c tracing: Dump stacktrace trigger to the corresponding instance 2022-04-27 13:15:29 +02:00
trace_export.c
trace_functions.c tracing: Have all levels of checks prevent recursion 2021-10-27 09:51:41 +02:00
trace_functions_graph.c
trace_hwlat.c tracing/hwlat: Honor the tracing_cpumask 2020-08-21 09:48:19 +02:00
trace_irqsoff.c tracing: Fix memleak due to race between current_tracer and trace 2023-08-30 16:35:14 +02:00
trace_kdb.c
trace_kprobe.c ftrace/kprobe: Show the maxactive number on kprobe_events 2020-04-24 08:00:50 +02:00
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Make sure trace_printk() can output as soon as it can be used 2023-02-06 07:46:31 +01:00
trace_output.h
trace_printk.c
trace_probe.c
trace_probe.h
trace_sched_switch.c tracing: Fix sched switch start/stop refcount racy updates 2020-02-14 16:32:07 -05:00
trace_sched_wakeup.c tracing: Fix memleak due to race between current_tracer and trace 2023-08-30 16:35:14 +02:00
trace_selftest.c ftrace: Handle tracing when switching between context 2020-11-10 10:29:04 +01:00
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined 2020-01-14 20:05:40 +01:00
trace_stat.c tracing: Fix very unlikely race of registering two stat tracers 2020-02-28 16:35:58 +01:00
trace_stat.h
trace_syscalls.c
trace_uprobe.c
tracing_map.c tracing: Fix a kmemleak false positive in tracing_map 2021-12-22 09:17:58 +01:00
tracing_map.h