proc: actually make proc_fd_permission() thread-friendly
authorOleg Nesterov <oleg@redhat.com>
Thu, 22 Sep 2016 09:03:03 +0000 (14:03 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 27 Sep 2016 17:48:54 +0000 (10:48 -0700)
commitc753d28b558543d09bc423281b34b9f6f6745b87
treed2974401e802b0da548feb91a96cd03f9e4cd343
parent30e8bd116998fc52edb18aab5b32306fb41b7fa5
proc: actually make proc_fd_permission() thread-friendly

The commit 96d0df79f264 ("proc: make proc_fd_permission() thread-friendly")
fixed the access to /proc/self/fd from sub-threads, but introduced another
problem: a sub-thread can't access /proc/<tid>/fd/ or /proc/thread-self/fd
if generic_permission() fails.
Change proc_fd_permission() to check same_thread_group(pid_task(), current).

Bug 200237562

Change-Id: Id8e5c879305865062d8f0cce9887168a3193390d
Fixes: 96d0df79f264 ("proc: make proc_fd_permission() thread-friendly")
Reported-by: "Jin, Yihua" <yihua.jin@intel.com>
commit 54708d2858e79a2bdda10bf8a20c80eb96c20613
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-on: http://git-master/r/1225094
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
fs/proc/fd.c