From 2e0476a465648fe153a4d3f1d23e24fb4b89d68a Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Thu, 8 Jul 2021 16:54:58 +0000 Subject: [PATCH] Revert "FROMLIST: procfs: Allow reading fdinfo with PTRACE_MODE_READ" Revert submission 1578844 Reason for revert: Will be replaced by upstream version Reverted Changes: Ic9c551998:FROMLIST: BACKPORT: procfs/dmabuf: Add inode numbe... I41407760c:FROMLIST: procfs: Allow reading fdinfo with PTRACE... Bug: 159126739 Bug: 167141117 Signed-off-by: Kalesh Singh Change-Id: Iede4e9a65f87dad1ca0c6ecdeb42de47af4b37c8 --- fs/proc/base.c | 4 ++-- fs/proc/fd.c | 15 +-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 3096a0f34195..411fa66d5ec7 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3165,7 +3165,7 @@ static const struct pid_entry tgid_base_stuff[] = { DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations), DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), DIR("map_files", S_IRUSR|S_IXUSR, proc_map_files_inode_operations, proc_map_files_operations), - DIR("fdinfo", S_IRUGO|S_IXUGO, proc_fdinfo_inode_operations, proc_fdinfo_operations), + DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations), #ifdef CONFIG_NET DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), @@ -3509,7 +3509,7 @@ static const struct inode_operations proc_tid_comm_inode_operations = { */ static const struct pid_entry tid_base_stuff[] = { DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations), - DIR("fdinfo", S_IRUGO|S_IXUGO, proc_fdinfo_inode_operations, proc_fdinfo_operations), + DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations), #ifdef CONFIG_NET DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), diff --git a/fs/proc/fd.c b/fs/proc/fd.c index b0357e5d3950..81882a13212d 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -72,18 +71,6 @@ out: static int seq_fdinfo_open(struct inode *inode, struct file *file) { - bool allowed = false; - struct task_struct *task = get_proc_task(inode); - - if (!task) - return -ESRCH; - - allowed = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); - put_task_struct(task); - - if (!allowed) - return -EACCES; - return single_open(file, seq_show, inode); } @@ -338,7 +325,7 @@ static struct dentry *proc_fdinfo_instantiate(struct dentry *dentry, struct proc_inode *ei; struct inode *inode; - inode = proc_pid_make_inode(dentry->d_sb, task, S_IFREG | S_IRUGO); + inode = proc_pid_make_inode(dentry->d_sb, task, S_IFREG | S_IRUSR); if (!inode) return ERR_PTR(-ENOENT);