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.

Merge tag 'trace-v7.0-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

- Fix possible NULL pointer dereference in trace_data_alloc()

On the trace_data_alloc() error path, it can call trigger_data_free()
with a NULL pointer. This used to be a kfree() but was changed to
trigger_data_free() to clean up any partial initialization. The issue
is that trigger_data_free() does not expect a NULL pointer. Have
trigger_data_free() return safely on NULL pointer.

- Fix multiple events on the command line and bootconfig

If multiple events are enabled on the command line separately and not
grouped, only the last event gets enabled. That is:

trace_event=sched_switch trace_event=sched_waking

will only enable sched_waking whereas:

trace_event=sched_switch,sched_waking

will enable both.

The bootconfig makes it even worse as the second way is the more
common method.

The issue is that a temporary buffer is used to store the events to
enable later in boot. Each time the cmdline callback is called, it
overwrites what was previously there.

Have the callback append the next value (delimited by a comma) if the
temporary buffer already has content.

- Fix command line trace_buffer_size if >= 2G

The logic to allocate the trace buffer uses "int" for the size
parameter in the command line code causing overflow issues if more
that 2G is specified.

* tag 'trace-v7.0-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing: Fix trace_buf_size= cmdline parameter with sizes >= 2G
tracing: Fix enabling multiple events on the kernel command line and bootconfig
tracing: Add NULL pointer check to trigger_data_free()

+11 -4
+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
+5 -1
kernel/trace/trace_events.c
··· 4493 4493 4494 4494 static __init int setup_trace_event(char *str) 4495 4495 { 4496 - strscpy(bootup_event_buf, str, COMMAND_LINE_SIZE); 4496 + if (bootup_event_buf[0] != '\0') 4497 + strlcat(bootup_event_buf, ",", COMMAND_LINE_SIZE); 4498 + 4499 + strlcat(bootup_event_buf, str, COMMAND_LINE_SIZE); 4500 + 4497 4501 trace_set_ring_buffer_expanded(NULL); 4498 4502 disable_tracing_selftest("running event tracing"); 4499 4503
+3
kernel/trace/trace_events_trigger.c
··· 50 50 51 51 void trigger_data_free(struct event_trigger_data *data) 52 52 { 53 + if (!data) 54 + return; 55 + 53 56 if (data->cmd_ops->set_filter) 54 57 data->cmd_ops->set_filter(NULL, data, NULL); 55 58