Skip to content

Commit 3bbfe05

Browse files
author
Alexey Dobriyan
committed
proc: remove kernel.maps_protect
After commit 831830b aka "restrict reading from /proc/<pid>/maps to those who share ->mm or can ptrace" sysctl stopped being relevant because commit moved security checks from ->show time to ->start time (mm_for_maps()). Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Acked-by: Kees Cook <kees.cook@canonical.com>
1 parent 45acb8d commit 3bbfe05

6 files changed

Lines changed: 1 addition & 43 deletions

File tree

‎Documentation/filesystems/proc.txt‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,13 +1332,6 @@ determine whether or not they are still functioning properly.
13321332
Because the NMI watchdog shares registers with oprofile, by disabling the NMI
13331333
watchdog, oprofile may have more registers to utilize.
13341334

1335-
maps_protect
1336-
------------
1337-
1338-
Enables/Disables the protection of the per-process proc entries "maps" and
1339-
"smaps". When enabled, the contents of these files are visible only to
1340-
readers that are allowed to ptrace() the given process.
1341-
13421335
msgmni
13431336
------
13441337

‎fs/proc/base.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ static unsigned int pid_entry_count_dirs(const struct pid_entry *entries,
148148
return count;
149149
}
150150

151-
int maps_protect;
152-
EXPORT_SYMBOL(maps_protect);
153-
154151
static struct fs_struct *get_fs_struct(struct task_struct *task)
155152
{
156153
struct fs_struct *fs;

‎fs/proc/internal.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ do { \
4545
extern int nommu_vma_show(struct seq_file *, struct vm_area_struct *);
4646
#endif
4747

48-
extern int maps_protect;
49-
5048
extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
5149
struct pid *pid, struct task_struct *task);
5250
extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,

‎fs/proc/task_mmu.c‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ static int show_map(struct seq_file *m, void *v)
210210
dev_t dev = 0;
211211
int len;
212212

213-
if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
214-
return -EACCES;
215-
216213
if (file) {
217214
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
218215
dev = inode->i_sb->s_dev;
@@ -742,22 +739,11 @@ const struct file_operations proc_pagemap_operations = {
742739
#ifdef CONFIG_NUMA
743740
extern int show_numa_map(struct seq_file *m, void *v);
744741

745-
static int show_numa_map_checked(struct seq_file *m, void *v)
746-
{
747-
struct proc_maps_private *priv = m->private;
748-
struct task_struct *task = priv->task;
749-
750-
if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
751-
return -EACCES;
752-
753-
return show_numa_map(m, v);
754-
}
755-
756742
static const struct seq_operations proc_pid_numa_maps_op = {
757743
.start = m_start,
758744
.next = m_next,
759745
.stop = m_stop,
760-
.show = show_numa_map_checked
746+
.show = show_numa_map,
761747
};
762748

763749
static int numa_maps_open(struct inode *inode, struct file *file)

‎fs/proc/task_nommu.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
110110
static int show_map(struct seq_file *m, void *_vml)
111111
{
112112
struct vm_list_struct *vml = _vml;
113-
struct proc_maps_private *priv = m->private;
114-
struct task_struct *task = priv->task;
115-
116-
if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
117-
return -EACCES;
118113

119114
return nommu_vma_show(m, vml->vma);
120115
}

‎kernel/sysctl.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ extern int pid_max_min, pid_max_max;
8080
extern int sysctl_drop_caches;
8181
extern int percpu_pagelist_fraction;
8282
extern int compat_log;
83-
extern int maps_protect;
8483
extern int latencytop_enabled;
8584
extern int sysctl_nr_open_min, sysctl_nr_open_max;
8685
#ifdef CONFIG_RCU_TORTURE_TEST
@@ -809,16 +808,6 @@ static struct ctl_table kern_table[] = {
809808
.mode = 0644,
810809
.proc_handler = &proc_dointvec,
811810
},
812-
#endif
813-
#ifdef CONFIG_PROC_FS
814-
{
815-
.ctl_name = CTL_UNNUMBERED,
816-
.procname = "maps_protect",
817-
.data = &maps_protect,
818-
.maxlen = sizeof(int),
819-
.mode = 0644,
820-
.proc_handler = &proc_dointvec,
821-
},
822811
#endif
823812
{
824813
.ctl_name = CTL_UNNUMBERED,

0 commit comments

Comments
 (0)