Merge tag 'trace-v6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

- Fix timerlat with use of FORTIFY_SOURCE

FORTIFY_SOURCE was added to the stack tracer where it compares the
entry->caller array to having entry->size elements.

timerlat has the following:

memcpy(&entry->caller, fstack->calls, size);
entry->size = size;

Which triggers FORTIFY_SOURCE as the caller is populated before the
entry->size is initialized.

Swap the order to satisfy FORTIFY_SOURCE logic.

- Add down_write(trace_event_sem) when adding trace events in modules

Trace events being added to the ftrace_events array are protected by
the trace_event_sem semaphore. But when loading modules that have
trace events, the addition of the events are not protected by the
semaphore and loading two modules that have events at the same time
can corrupt the list.

Also add a lockdep_assert_held(trace_event_sem) to
_trace_add_event_dirs() to confirm it is held when iterating the
list.

* tag 'trace-v6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing: Add down_write(trace_event_sem) when adding trace event
tracing/osnoise: Fix crash in timerlat_dump_stack()

Changed files
+6 -1
kernel
+5
kernel/trace/trace_events.c
··· 3136 3136 if (ret < 0) 3137 3137 return ret; 3138 3138 3139 + down_write(&trace_event_sem); 3139 3140 list_add(&call->list, &ftrace_events); 3141 + up_write(&trace_event_sem); 3142 + 3140 3143 if (call->flags & TRACE_EVENT_FL_DYNAMIC) 3141 3144 atomic_set(&call->refcnt, 0); 3142 3145 else ··· 3752 3749 { 3753 3750 struct trace_event_call *call; 3754 3751 int ret; 3752 + 3753 + lockdep_assert_held(&trace_event_sem); 3755 3754 3756 3755 list_for_each_entry(call, &ftrace_events, list) { 3757 3756 ret = __trace_add_new_event(call, tr);
+1 -1
kernel/trace/trace_osnoise.c
··· 637 637 638 638 entry = ring_buffer_event_data(event); 639 639 640 - memcpy(&entry->caller, fstack->calls, size); 641 640 entry->size = fstack->nr_entries; 641 + memcpy(&entry->caller, fstack->calls, size); 642 642 643 643 trace_buffer_unlock_commit_nostack(buffer, event); 644 644 }