mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] tracing: Fixes for 6.16
@ 2025-07-20 18:53 Steven Rostedt
  2025-07-20 22:20 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2025-07-20 18:53 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Tomas Glozar


Linus,

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.


Please pull the latest trace-v6.16-rc5 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.16-rc5

Tag SHA1: 3fa4ea79493691015e6e08d752e502a80d3364a6
Head SHA1: b5e8acc14dcb314a9b61ff19dcd9fdd0d88f70df


Steven Rostedt (1):
      tracing: Add down_write(trace_event_sem) when adding trace event

Tomas Glozar (1):
      tracing/osnoise: Fix crash in timerlat_dump_stack()

----
 kernel/trace/trace_events.c  | 5 +++++
 kernel/trace/trace_osnoise.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
---------------------------
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 120531268abf..d01e5c910ce1 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -3136,7 +3136,10 @@ __register_event(struct trace_event_call *call, struct module *mod)
 	if (ret < 0)
 		return ret;
 
+	down_write(&trace_event_sem);
 	list_add(&call->list, &ftrace_events);
+	up_write(&trace_event_sem);
+
 	if (call->flags & TRACE_EVENT_FL_DYNAMIC)
 		atomic_set(&call->refcnt, 0);
 	else
@@ -3750,6 +3753,8 @@ __trace_add_event_dirs(struct trace_array *tr)
 	struct trace_event_call *call;
 	int ret;
 
+	lockdep_assert_held(&trace_event_sem);
+
 	list_for_each_entry(call, &ftrace_events, list) {
 		ret = __trace_add_new_event(call, tr);
 		if (ret < 0)
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 6819b93309ce..fd259da0aa64 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -637,8 +637,8 @@ __timerlat_dump_stack(struct trace_buffer *buffer, struct trace_stack *fstack, u
 
 	entry = ring_buffer_event_data(event);
 
-	memcpy(&entry->caller, fstack->calls, size);
 	entry->size = fstack->nr_entries;
+	memcpy(&entry->caller, fstack->calls, size);
 
 	trace_buffer_unlock_commit_nostack(buffer, event);
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] tracing: Fixes for 6.16
  2025-07-20 18:53 [GIT PULL] tracing: Fixes for 6.16 Steven Rostedt
@ 2025-07-20 22:20 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2025-07-20 22:20 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, LKML, Masami Hiramatsu, Mathieu Desnoyers, Tomas Glozar

The pull request you sent on Sun, 20 Jul 2025 14:53:39 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v6.16-rc5

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/2013e8c2e6fd3a4bdf4ccc658ad20a4469360eff

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-20 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-20 18:53 [GIT PULL] tracing: Fixes for 6.16 Steven Rostedt
2025-07-20 22:20 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®