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: 3fdaf80f ("tracing: Implement event pid filtering")
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 1880ed71
...@@ -2678,12 +2678,24 @@ static struct trace_event_file * ...@@ -2678,12 +2678,24 @@ static struct trace_event_file *
trace_create_new_event(struct trace_event_call *call, trace_create_new_event(struct trace_event_call *call,
struct trace_array *tr) struct trace_array *tr)
{ {
struct trace_pid_list *no_pid_list;
struct trace_pid_list *pid_list;
struct trace_event_file *file; struct trace_event_file *file;
unsigned int first;
file = kmem_cache_alloc(file_cachep, GFP_TRACE); file = kmem_cache_alloc(file_cachep, GFP_TRACE);
if (!file) if (!file)
return NULL; return NULL;
pid_list = rcu_dereference_protected(tr->filtered_pids,
lockdep_is_held(&event_mutex));
no_pid_list = rcu_dereference_protected(tr->filtered_no_pids,
lockdep_is_held(&event_mutex));
if (!trace_pid_list_first(pid_list, &first) ||
!trace_pid_list_first(pid_list, &first))
file->flags |= EVENT_FILE_FL_PID_FILTER;
file->event_call = call; file->event_call = call;
file->tr = tr; file->tr = tr;
atomic_set(&file->sm_ref, 0); atomic_set(&file->sm_ref, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment