Skip to content

Commit 406f2d5

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 4fd0ad0 commit 406f2d5

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
@@ -2462,12 +2462,22 @@ static struct trace_event_file *
24622462
trace_create_new_event(struct trace_event_call *call,
24632463
struct trace_array *tr)
24642464
{
2465+
struct trace_pid_list *no_pid_list;
2466+
struct trace_pid_list *pid_list;
24652467
struct trace_event_file *file;
24662468

24672469
file = kmem_cache_alloc(file_cachep, GFP_TRACE);
24682470
if (!file)
24692471
return NULL;
24702472

2473+
pid_list = rcu_dereference_protected(tr->filtered_pids,
2474+
lockdep_is_held(&event_mutex));
2475+
no_pid_list = rcu_dereference_protected(tr->filtered_no_pids,
2476+
lockdep_is_held(&event_mutex));
2477+
2478+
if (pid_list || no_pid_list)
2479+
file->flags |= EVENT_FILE_FL_PID_FILTER;
2480+
24712481
file->event_call = call;
24722482
file->tr = tr;
24732483
atomic_set(&file->sm_ref, 0);

0 commit comments

Comments
 (0)