]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
procfs: fix pthread cross-thread naming if !PR_DUMPABLE
authorJanis Danisevskis <jdanis@google.com>
Thu, 11 May 2017 21:10:19 +0000 (18:10 -0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 20 Jun 2017 10:16:15 +0000 (12:16 +0200)
commit94e574b8b65295824a5de90b262133936c1555ac
treeacbb2b76bdc49782a8f13e28f932f8b5b6ad4748
parent1a8f0139fd25b10cdf0d11bd3d09a544110399c1
procfs: fix pthread cross-thread naming if !PR_DUMPABLE

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1690225
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: Janis Danisevskis <jdanis@google.com>
Acked-by: Kees 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 1b3044e39a89cb1d4d5313da477e8dfea2b5232d)
Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
fs/proc/base.c