Skip to content

Commit c9c8c05

Browse files
rostedtgregkh
authored andcommitted
tracing: Check pid filtering when creating events
commit 6cb2065 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6e56e87 commit c9c8c05

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎kernel/trace/trace_events.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,12 +2678,22 @@ 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;
26822684

26832685
file = kmem_cache_alloc(file_cachep, GFP_TRACE);
26842686
if (!file)
26852687
return NULL;
26862688

2689+
pid_list = rcu_dereference_protected(tr->filtered_pids,
2690+
lockdep_is_held(&event_mutex));
2691+
no_pid_list = rcu_dereference_protected(tr->filtered_no_pids,
2692+
lockdep_is_held(&event_mutex));
2693+
2694+
if (pid_list || no_pid_list)
2695+
file->flags |= EVENT_FILE_FL_PID_FILTER;
2696+
26872697
file->event_call = call;
26882698
file->tr = tr;
26892699
atomic_set(&file->sm_ref, 0);

0 commit comments

Comments
 (0)