mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
tracing/syscalls: fix missing release of tracing
Impact: fix 'stuck' syscall tracer The syscall tracer uses a refcounter to enable several users simultaneously. But the refcounter did not behave correctly and always restored its value to 0 after calling start_syscall_tracing(). Therefore, stop_syscall_tracing() couldn't release correctly the tasks from tracing. Also the tracer forgot to reset the buffer when it is released. Drop the pointless refcount decrement on start_syscall_tracing() and reset the buffer when we release the tracer. This fixes two reported issue: - when we switch from syscall tracer to another tracer, syscall tracing continued. - incorrect use of the refcount. Reported-by: Andrew Morton <[email protected]> Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
7243f2145a
commit
ac99c58c9e
1 changed files with 5 additions and 6 deletions
|
|
@ -96,8 +96,9 @@ void start_ftrace_syscalls(void)
|
|||
unsigned long flags;
|
||||
struct task_struct *g, *t;
|
||||
|
||||
/* Don't enable the flag on the tasks twice */
|
||||
if (atomic_inc_return(&refcount) != 1)
|
||||
goto out;
|
||||
return;
|
||||
|
||||
arch_init_ftrace_syscalls();
|
||||
read_lock_irqsave(&tasklist_lock, flags);
|
||||
|
|
@ -107,8 +108,6 @@ void start_ftrace_syscalls(void)
|
|||
} while_each_thread(g, t);
|
||||
|
||||
read_unlock_irqrestore(&tasklist_lock, flags);
|
||||
out:
|
||||
atomic_dec(&refcount);
|
||||
}
|
||||
|
||||
void stop_ftrace_syscalls(void)
|
||||
|
|
@ -116,8 +115,9 @@ void stop_ftrace_syscalls(void)
|
|||
unsigned long flags;
|
||||
struct task_struct *g, *t;
|
||||
|
||||
/* There are perhaps still some users */
|
||||
if (atomic_dec_return(&refcount))
|
||||
goto out;
|
||||
return;
|
||||
|
||||
read_lock_irqsave(&tasklist_lock, flags);
|
||||
|
||||
|
|
@ -126,8 +126,6 @@ void stop_ftrace_syscalls(void)
|
|||
} while_each_thread(g, t);
|
||||
|
||||
read_unlock_irqrestore(&tasklist_lock, flags);
|
||||
out:
|
||||
atomic_inc(&refcount);
|
||||
}
|
||||
|
||||
void ftrace_syscall_enter(struct pt_regs *regs)
|
||||
|
|
@ -201,6 +199,7 @@ static int init_syscall_tracer(struct trace_array *tr)
|
|||
static void reset_syscall_tracer(struct trace_array *tr)
|
||||
{
|
||||
stop_ftrace_syscalls();
|
||||
tracing_reset_online_cpus(tr);
|
||||
}
|
||||
|
||||
static struct trace_event syscall_enter_event = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue