]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/proc/task_nommu.c
proc: maps protection
[net-next-2.6.git] / fs / proc / task_nommu.c
index 7cddf6b8635aa612362042e4b3609a270a61555c..d8b8c7183c243d86455390f1246da6c12891d396 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/mm.h>
 #include <linux/file.h>
 #include <linux/mount.h>
+#include <linux/ptrace.h>
 #include <linux/seq_file.h>
 #include "internal.h"
 
@@ -143,6 +144,12 @@ out:
 static int show_map(struct seq_file *m, void *_vml)
 {
        struct vm_list_struct *vml = _vml;
+       struct proc_maps_private *priv = m->private;
+       struct task_struct *task = priv->task;
+
+       if (maps_protect && !ptrace_may_attach(task))
+               return -EACCES;
+
        return nommu_vma_show(m, vml->vma);
 }