tracing/syscalls: protect thread flag toggling from races
authorFrederic Weisbecker <fweisbec@gmail.com>
Sun, 15 Mar 2009 21:10:37 +0000 (22:10 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 16 Mar 2009 08:13:16 +0000 (09:13 +0100)
Impact: fix syscall tracer enable/disable race

The current thread flag toggling is racy as shown in the following
scenario:

- task A is the last user of syscall tracing, it releases the
  TIF_SYSCALL_FTRACE on each tasks

- at the same time task B start syscall tracing. refcount == 0 so
  it sets up TIF_SYSCALL_FTRACE on each tasks.

The effect of the mixup is unpredictable.
So this fix adds a mutex on {start,stop}_syscall_tracing().

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1237151439-6755-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

No differences found