mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
Tracing fixes for 6.16:
- 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 its held when iterating the list.
-----BEGIN PGP SIGNATURE-----
iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCaH06gBQccm9zdGVkdEBn
b29kbWlzLm9yZwAKCRAp5XQQmuv6qoJsAP0a+/E0f+5g7O/OtYPVEDSCREv1vj9c
3dr0iWopqaOC7gEAw8Vc5iWIHKcB/JuJ+GqALoutL+lihruG26MWkFFsOgU=
=zH5J
-----END PGP SIGNATURE-----
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()
This commit is contained in:
commit
2013e8c2e6
|
|
@ -3136,7 +3136,10 @@ __register_event(struct trace_event_call *call, struct module *mod)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
down_write(&trace_event_sem);
|
||||||
list_add(&call->list, &ftrace_events);
|
list_add(&call->list, &ftrace_events);
|
||||||
|
up_write(&trace_event_sem);
|
||||||
|
|
||||||
if (call->flags & TRACE_EVENT_FL_DYNAMIC)
|
if (call->flags & TRACE_EVENT_FL_DYNAMIC)
|
||||||
atomic_set(&call->refcnt, 0);
|
atomic_set(&call->refcnt, 0);
|
||||||
else
|
else
|
||||||
|
|
@ -3750,6 +3753,8 @@ __trace_add_event_dirs(struct trace_array *tr)
|
||||||
struct trace_event_call *call;
|
struct trace_event_call *call;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
lockdep_assert_held(&trace_event_sem);
|
||||||
|
|
||||||
list_for_each_entry(call, &ftrace_events, list) {
|
list_for_each_entry(call, &ftrace_events, list) {
|
||||||
ret = __trace_add_new_event(call, tr);
|
ret = __trace_add_new_event(call, tr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
||||||
|
|
@ -637,8 +637,8 @@ __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, u
|
||||||
|
|
||||||
entry = ring_buffer_event_data(event);
|
entry = ring_buffer_event_data(event);
|
||||||
|
|
||||||
memcpy(&entry->caller, fstack->calls, size);
|
|
||||||
entry->size = fstack->nr_entries;
|
entry->size = fstack->nr_entries;
|
||||||
|
memcpy(&entry->caller, fstack->calls, size);
|
||||||
|
|
||||||
trace_buffer_unlock_commit_nostack(buffer, event);
|
trace_buffer_unlock_commit_nostack(buffer, event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user