• Frederic Weisbecker's avatar
    posix-timers: Use sighand lock instead of tasklist_lock for task clock sample · 50875788
    Frederic Weisbecker authored
    There is no need for the tasklist_lock just to take a process
    wide clock sample.
    
    All we need is to get a coherent sample that doesn't race with
    exit() and exec():
    
    * exit() may be concurrently reaping a task and flushing its time
    
    * sighand is unstable under exit() and exec(), and the latter also
      result in group leader that can change
    
    To protect against these, locking the target's sighand is enough.
    Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    50875788
posix-cpu-timers.c 37.7 KB