Skip to content
  • Janis Danisevskis's avatar
    procfs: fix pthread cross-thread naming if !PR_DUMPABLE · 1b3044e3
    Janis Danisevskis authored
    
    
    The PR_DUMPABLE flag causes the pid related paths of the proc file
    system to be owned by ROOT.
    
    The implementation of pthread_set/getname_np however needs access to
    /proc/<pid>/task/<tid>/comm.  If PR_DUMPABLE is false this
    implementation is locked out.
    
    This patch installs a special permission function for the file "comm"
    that grants read and write access to all threads of the same group
    regardless of the ownership of the inode.  For all other threads the
    function falls back to the generic inode permission check.
    
    [akpm@linux-foundation.org: fix spello in comment]
    Signed-off-by: default avatarJanis Danisevskis <jdanis@google.com>
    Acked-by: default avatarKees Cook <keescook@chromium.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Cyrill Gorcunov <gorcunov@openvz.org>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Colin Ian King <colin.king@canonical.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Minfei Huang <mnfhuang@gmail.com>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Calvin Owens <calvinowens@fb.com>
    Cc: Jann Horn <jann@thejh.net>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1b3044e3