Skip to content

Commit 6cb2065

Browse files
committed
tracing: Check pid filtering when creating events
When pid filtering is activated in an instance, all of the events trace files for that instance has the PID_FILTER flag set. This determines whether or not pid filtering needs to be done on the event, otherwise the event is executed as normal. If pid filtering is enabled when an event is created (via a dynamic event or modules), its flag is not updated to reflect the current state, and the events are not filtered properly. Cc: stable@vger.kernel.org Fixes: 3fdaf80 ("tracing: Implement event pid filtering") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 1880ed7 commit 6cb2065

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/trace/trace_events.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,12 +2678,24 @@ static struct trace_event_file *
26782678
trace_create_new_event(struct trace_event_call *call,
26792679
struct trace_array *tr)
26802680
{
2681+
struct trace_pid_list *no_pid_list;
2682+
struct trace_pid_list *pid_list;
26812683
struct trace_event_file *file;
2684+
unsigned int first;
26822685

26832686
file = kmem_cache_alloc(file_cachep, GFP_TRACE);
26842687
if (!file)
26852688
return NULL;
26862689

2690+
pid_list = rcu_dereference_protected(tr->filtered_pids,
2691+
lockdep_is_held(&event_mutex));
2692+
no_pid_list = rcu_dereference_protected(tr->filtered_no_pids,
2693+
lockdep_is_held(&event_mutex));
2694+
2695+
if (!trace_pid_list_first(pid_list, &first) ||
2696+
!trace_pid_list_first(pid_list, &first))
2697+
file->flags |= EVENT_FILE_FL_PID_FILTER;
2698+
26872699
file->event_call = call;
26882700
file->tr = tr;
26892701
atomic_set(&file->sm_ref, 0);

0 commit comments

Comments
 (0)