Skip to content

Commit 53cf810

Browse files
committed
tracing: Allow syscall trace events for non privileged users
As for the raw syscalls events, individual syscall events won't leak system wide information on task bound tracing. Allow non privileged users to use them in such workflow. Signed-off-by: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Li Zefan <[email protected]> Cc: Jason Baron <[email protected]>
1 parent fe55420 commit 53cf810

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

include/linux/ftrace_event.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ struct ftrace_event_call {
198198
#endif
199199
};
200200

201+
#define __TRACE_EVENT_FLAGS(name, value) \
202+
static int __init trace_init_flags_##name(void) \
203+
{ \
204+
event_##name.flags = value; \
205+
return 0; \
206+
} \
207+
early_initcall(trace_init_flags_##name);
208+
201209
#define PERF_MAX_TRACE_SIZE 2048
202210

203211
#define MAX_FILTER_PRED 32

include/linux/syscalls.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
137137
.class = &event_class_syscall_enter, \
138138
.event.funcs = &enter_syscall_print_funcs, \
139139
.data = (void *)&__syscall_meta_##sname,\
140-
}
140+
}; \
141+
__TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY)
141142

142143
#define SYSCALL_TRACE_EXIT_EVENT(sname) \
143144
static struct syscall_metadata \
@@ -152,7 +153,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
152153
.class = &event_class_syscall_exit, \
153154
.event.funcs = &exit_syscall_print_funcs, \
154155
.data = (void *)&__syscall_meta_##sname,\
155-
}
156+
}; \
157+
__TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY)
156158

157159
#define SYSCALL_METADATA(sname, nb) \
158160
SYSCALL_TRACE_ENTER_EVENT(sname); \

include/trace/ftrace.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,7 @@
8484

8585
#undef TRACE_EVENT_FLAGS
8686
#define TRACE_EVENT_FLAGS(name, value) \
87-
static int __init trace_init_flags_##name(void) \
88-
{ \
89-
event_##name.flags = value; \
90-
return 0; \
91-
} \
92-
early_initcall(trace_init_flags_##name);
87+
__TRACE_EVENT_FLAGS(name, value)
9388

9489
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
9590

0 commit comments

Comments
 (0)