• Thomas Gleixner's avatar
    audit: Call tty_audit_push_task() outside preempt disabled · 3c80fe4a
    Thomas Gleixner authored
    While auditing all tasklist_lock read_lock sites I stumbled over the
    following call chain:
    
    audit_prepare_user_tty()
      read_lock(&tasklist_lock);
      tty_audit_push_task();
         mutex_lock(&buf->mutex);
    
         --> buf->mutex is locked with preemption disabled.
    
    Solve this by acquiring a reference to the task struct under
    rcu_read_lock and call tty_audit_push_task outside of the preempt
    disabled region.
    
    Move all code which needs to be protected by sighand lock into
    tty_audit_push_task() and use lock/unlock_sighand as we do not hold
    tasklist_lock.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Eric Paris <eparis@redhat.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    3c80fe4a
audit.c 39.3 KB