X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fproc%2Ftask_mmu.c;h=c24d81a5a040e2a91825673434339e3c2f1dcdda;hb=0a4908e19fd016d60403fc76cf38b2d08d21e2d2;hp=4008c060f7ef1b2b9ddc51154d30e1ec865906a5;hpb=2d56d3c43cc97ae48586745556f5a5b564d61582;p=linux-2.6 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 4008c060f7..c24d81a5a0 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -142,6 +143,9 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats dev_t dev = 0; int len; + if (maps_protect && !ptrace_may_attach(task)) + return -EACCES; + if (file) { struct inode *inode = vma->vm_file->f_path.dentry->d_inode; dev = inode->i_sb->s_dev; @@ -512,11 +516,22 @@ const struct file_operations proc_maps_operations = { #ifdef CONFIG_NUMA extern int show_numa_map(struct seq_file *m, void *v); +static int show_numa_map_checked(struct seq_file *m, void *v) +{ + struct proc_maps_private *priv = m->private; + struct task_struct *task = priv->task; + + if (maps_protect && !ptrace_may_attach(task)) + return -EACCES; + + return show_numa_map(m, v); +} + static struct seq_operations proc_pid_numa_maps_op = { .start = m_start, .next = m_next, .stop = m_stop, - .show = show_numa_map + .show = show_numa_map_checked }; static int numa_maps_open(struct inode *inode, struct file *file)