Remove the "Nasty, nasty" lock dance in ptrace_attach()/ptrace_traceme().From now task_lock() has nothing to do with ptrace at all.

With the recent changes nobody uses task_lock() to serialize with ptrace,but in fact it was never needed and it was never used consistently.

However ptrace_attach() calls __ptrace_may_access() and needs task_lock()to pin task->mm for get_dumpable(). But we can call __ptrace_may_access()before we take tasklist_lock, ->cred_exec_mutex protects us againstdo_execve() path which can change creds and MMF_DUMP* flags.

(ugly, but we can't use ptrace_may_access() because it hides the error code, so we have to take task_lock() and use __ptrace_may_access()).

NOTE: this change assumes that LSM hooks, security_ptrace_may_access() andsecurity_ptrace_traceme(), can be called without task_lock() held.