Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Fix trace_buf_size= cmdline parameter with sizes >= 2G

Some of the sizing logic through tracer_alloc_buffers() uses int
internally, causing unexpected behavior if the user passes a value that
does not fit in an int (on my x86 machine, the result is uselessly tiny
buffers).

Fix by plumbing the parameter's real type (unsigned long) through to the
ring buffer allocation functions, which already use unsigned long.

It has always been possible to create larger ring buffers via the sysfs
interface: this only affects the cmdline parameter.

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/bff42a4288aada08bdf74da3f5b67a2c28b761f8.1772852067.git.calvin@wbinvd.org
Fixes: 73c5162aa362 ("tracing: keep ring buffer to minimum size till used")
Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Calvin Owens and committed by
Steven Rostedt (Google)
d008ba8b 3b1679e0

+3 -3
+3 -3
kernel/trace/trace.c
··· 9350 9350 } 9351 9351 9352 9352 static int 9353 - allocate_trace_buffer(struct trace_array *tr, struct array_buffer *buf, int size) 9353 + allocate_trace_buffer(struct trace_array *tr, struct array_buffer *buf, unsigned long size) 9354 9354 { 9355 9355 enum ring_buffer_flags rb_flags; 9356 9356 struct trace_scratch *tscratch; ··· 9405 9405 } 9406 9406 } 9407 9407 9408 - static int allocate_trace_buffers(struct trace_array *tr, int size) 9408 + static int allocate_trace_buffers(struct trace_array *tr, unsigned long size) 9409 9409 { 9410 9410 int ret; 9411 9411 ··· 10769 10769 10770 10770 __init static int tracer_alloc_buffers(void) 10771 10771 { 10772 - int ring_buf_size; 10772 + unsigned long ring_buf_size; 10773 10773 int ret = -ENOMEM; 10774 10774 10775 10775