Skip to content

Commit ee41106

Browse files
committed
tracing: Require all trace events to have a TRACE_SYSTEM
The creation of the trace event directory requires that a TRACE_SYSTEM is defined that the trace event directory is added within the system it was defined in. The code handled the case where a TRACE_SYSTEM was not added, and would then add the event at the events directory. But nothing should be doing this. This code also prevents the implementation of creating dynamic dentrys for the eventfs system. As this path has never been hit on correct code, remove it. If it does get hit, issues a WARN_ON_ONCE() and return ENODEV. Link: https://lkml.kernel.org/r/1690568452-46553-2-git-send-email-akaher@vmware.com Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Ajay Kaher <akaher@vmware.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 6d98a0f commit ee41106

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

kernel/trace/trace_events.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,14 +2420,15 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
24202420

24212421
/*
24222422
* If the trace point header did not define TRACE_SYSTEM
2423-
* then the system would be called "TRACE_SYSTEM".
2423+
* then the system would be called "TRACE_SYSTEM". This should
2424+
* never happen.
24242425
*/
2425-
if (strcmp(call->class->system, TRACE_SYSTEM) != 0) {
2426-
d_events = event_subsystem_dir(tr, call->class->system, file, parent);
2427-
if (!d_events)
2428-
return -ENOMEM;
2429-
} else
2430-
d_events = parent;
2426+
if (WARN_ON_ONCE(strcmp(call->class->system, TRACE_SYSTEM) == 0))
2427+
return -ENODEV;
2428+
2429+
d_events = event_subsystem_dir(tr, call->class->system, file, parent);
2430+
if (!d_events)
2431+
return -ENOMEM;
24312432

24322433
name = trace_event_name(call);
24332434
file->dir = tracefs_create_dir(name, d_events);

0 commit comments

Comments
 (0)