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 <kaleshsingh@google.com> Change-Id: Iede4e9a65f87dad1ca0c6ecdeb42de47af4b37c8
This commit is contained in:
@@ -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("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("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("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),
|
DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations),
|
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[] = {
|
static const struct pid_entry tid_base_stuff[] = {
|
||||||
DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
|
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),
|
DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations),
|
DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations),
|
||||||
|
15
fs/proc/fd.c
15
fs/proc/fd.c
@@ -6,7 +6,6 @@
|
|||||||
#include <linux/fdtable.h>
|
#include <linux/fdtable.h>
|
||||||
#include <linux/namei.h>
|
#include <linux/namei.h>
|
||||||
#include <linux/pid.h>
|
#include <linux/pid.h>
|
||||||
#include <linux/ptrace.h>
|
|
||||||
#include <linux/security.h>
|
#include <linux/security.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
@@ -72,18 +71,6 @@ out:
|
|||||||
|
|
||||||
static int seq_fdinfo_open(struct inode *inode, struct file *file)
|
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);
|
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 proc_inode *ei;
|
||||||
struct inode *inode;
|
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)
|
if (!inode)
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user