diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-10-21 15:27:36 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-10-25 21:33:56 -0400 |
commit | 8ca532ad2b050da0d0db3544d9ab8b40675e4ca1 (patch) | |
tree | ccba6d4d2730df8ebc3d2ca5747d0006cd2ff762 /kernel | |
parent | 3fdaf80f4a836911c0eda1cee92f8aa625f90197 (diff) |
tracing: Check all tasks on each CPU when filtering pids
My tests found that if a task is running but not filtered when set_event_pid
is modified, then it can still be traced.
Call on_each_cpu() to check if the current running task should be filtered
and update the per cpu flags of tr->data appropriately.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_events.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index ab07058e27c1..2b7fccd499c6 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -1549,6 +1549,22 @@ static int max_pids(struct trace_pid_list *pid_list) | |||
1549 | return (PAGE_SIZE << pid_list->order) / sizeof(pid_t); | 1549 | return (PAGE_SIZE << pid_list->order) / sizeof(pid_t); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | static void ignore_task_cpu(void *data) | ||
1553 | { | ||
1554 | struct trace_array *tr = data; | ||
1555 | struct trace_pid_list *pid_list; | ||
1556 | |||
1557 | /* | ||
1558 | * This function is called by on_each_cpu() while the | ||
1559 | * event_mutex is held. | ||
1560 | */ | ||
1561 | pid_list = rcu_dereference_protected(tr->filtered_pids, | ||
1562 | mutex_is_locked(&event_mutex)); | ||
1563 | |||
1564 | this_cpu_write(tr->trace_buffer.data->ignore_pid, | ||
1565 | check_ignore_pid(pid_list, current)); | ||
1566 | } | ||
1567 | |||
1552 | static ssize_t | 1568 | static ssize_t |
1553 | ftrace_event_pid_write(struct file *filp, const char __user *ubuf, | 1569 | ftrace_event_pid_write(struct file *filp, const char __user *ubuf, |
1554 | size_t cnt, loff_t *ppos) | 1570 | size_t cnt, loff_t *ppos) |
@@ -1711,6 +1727,12 @@ ftrace_event_pid_write(struct file *filp, const char __user *ubuf, | |||
1711 | tr, INT_MAX); | 1727 | tr, INT_MAX); |
1712 | register_trace_prio_sched_wakeup(event_filter_pid_sched_wakeup_probe_post, | 1728 | register_trace_prio_sched_wakeup(event_filter_pid_sched_wakeup_probe_post, |
1713 | tr, 0); | 1729 | tr, 0); |
1730 | |||
1731 | /* | ||
1732 | * Ignoring of pids is done at task switch. But we have to | ||
1733 | * check for those tasks that are currently running. | ||
1734 | */ | ||
1735 | on_each_cpu(ignore_task_cpu, tr, 1); | ||
1714 | } | 1736 | } |
1715 | 1737 | ||
1716 | mutex_unlock(&event_mutex); | 1738 | mutex_unlock(&event_mutex); |