diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-07-26 18:04:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-26 18:04:59 -0400 |
commit | d9ecdb282c91952796b7542c4f57fd6de6948d7b (patch) | |
tree | fd4de7923968afa7d2981fb037e2255fc2cfa1e1 /fs/proc | |
parent | 4ef584ba84125b67c17b5aded38e7783cd8cdef0 (diff) | |
parent | 1d1f8b377c48e5aeddaea52eba74cc0539f088cd (diff) |
Merge branch 'for_rmk_13' of git://git.mnementh.co.uk/linux-2.6-im
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 9 | ||||
-rw-r--r-- | fs/proc/base.c | 39 | ||||
-rw-r--r-- | fs/proc/generic.c | 5 | ||||
-rw-r--r-- | fs/proc/inode.c | 2 |
4 files changed, 44 insertions, 11 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 797d775e0354..0d6eb33597c6 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <linux/delayacct.h> | 80 | #include <linux/delayacct.h> |
81 | #include <linux/seq_file.h> | 81 | #include <linux/seq_file.h> |
82 | #include <linux/pid_namespace.h> | 82 | #include <linux/pid_namespace.h> |
83 | #include <linux/tracehook.h> | ||
83 | 84 | ||
84 | #include <asm/pgtable.h> | 85 | #include <asm/pgtable.h> |
85 | #include <asm/processor.h> | 86 | #include <asm/processor.h> |
@@ -168,8 +169,12 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
168 | rcu_read_lock(); | 169 | rcu_read_lock(); |
169 | ppid = pid_alive(p) ? | 170 | ppid = pid_alive(p) ? |
170 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; | 171 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; |
171 | tpid = pid_alive(p) && p->ptrace ? | 172 | tpid = 0; |
172 | task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0; | 173 | if (pid_alive(p)) { |
174 | struct task_struct *tracer = tracehook_tracer_task(p); | ||
175 | if (tracer) | ||
176 | tpid = task_pid_nr_ns(tracer, ns); | ||
177 | } | ||
173 | seq_printf(m, | 178 | seq_printf(m, |
174 | "State:\t%s\n" | 179 | "State:\t%s\n" |
175 | "Tgid:\t%d\n" | 180 | "Tgid:\t%d\n" |
diff --git a/fs/proc/base.c b/fs/proc/base.c index a891fe4cb43b..81bce6791bfc 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/mount.h> | 69 | #include <linux/mount.h> |
70 | #include <linux/security.h> | 70 | #include <linux/security.h> |
71 | #include <linux/ptrace.h> | 71 | #include <linux/ptrace.h> |
72 | #include <linux/tracehook.h> | ||
72 | #include <linux/cgroup.h> | 73 | #include <linux/cgroup.h> |
73 | #include <linux/cpuset.h> | 74 | #include <linux/cpuset.h> |
74 | #include <linux/audit.h> | 75 | #include <linux/audit.h> |
@@ -231,10 +232,14 @@ static int check_mem_permission(struct task_struct *task) | |||
231 | * If current is actively ptrace'ing, and would also be | 232 | * If current is actively ptrace'ing, and would also be |
232 | * permitted to freshly attach with ptrace now, permit it. | 233 | * permitted to freshly attach with ptrace now, permit it. |
233 | */ | 234 | */ |
234 | if (task->parent == current && (task->ptrace & PT_PTRACED) && | 235 | if (task_is_stopped_or_traced(task)) { |
235 | task_is_stopped_or_traced(task) && | 236 | int match; |
236 | ptrace_may_access(task, PTRACE_MODE_ATTACH)) | 237 | rcu_read_lock(); |
237 | return 0; | 238 | match = (tracehook_tracer_task(task) == current); |
239 | rcu_read_unlock(); | ||
240 | if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH)) | ||
241 | return 0; | ||
242 | } | ||
238 | 243 | ||
239 | /* | 244 | /* |
240 | * Noone else is allowed. | 245 | * Noone else is allowed. |
@@ -504,6 +509,26 @@ static int proc_pid_limits(struct task_struct *task, char *buffer) | |||
504 | return count; | 509 | return count; |
505 | } | 510 | } |
506 | 511 | ||
512 | #ifdef CONFIG_HAVE_ARCH_TRACEHOOK | ||
513 | static int proc_pid_syscall(struct task_struct *task, char *buffer) | ||
514 | { | ||
515 | long nr; | ||
516 | unsigned long args[6], sp, pc; | ||
517 | |||
518 | if (task_current_syscall(task, &nr, args, 6, &sp, &pc)) | ||
519 | return sprintf(buffer, "running\n"); | ||
520 | |||
521 | if (nr < 0) | ||
522 | return sprintf(buffer, "%ld 0x%lx 0x%lx\n", nr, sp, pc); | ||
523 | |||
524 | return sprintf(buffer, | ||
525 | "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", | ||
526 | nr, | ||
527 | args[0], args[1], args[2], args[3], args[4], args[5], | ||
528 | sp, pc); | ||
529 | } | ||
530 | #endif /* CONFIG_HAVE_ARCH_TRACEHOOK */ | ||
531 | |||
507 | /************************************************************************/ | 532 | /************************************************************************/ |
508 | /* Here the fs part begins */ | 533 | /* Here the fs part begins */ |
509 | /************************************************************************/ | 534 | /************************************************************************/ |
@@ -2473,6 +2498,9 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2473 | #ifdef CONFIG_SCHED_DEBUG | 2498 | #ifdef CONFIG_SCHED_DEBUG |
2474 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), | 2499 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), |
2475 | #endif | 2500 | #endif |
2501 | #ifdef CONFIG_HAVE_ARCH_TRACEHOOK | ||
2502 | INF("syscall", S_IRUSR, pid_syscall), | ||
2503 | #endif | ||
2476 | INF("cmdline", S_IRUGO, pid_cmdline), | 2504 | INF("cmdline", S_IRUGO, pid_cmdline), |
2477 | ONE("stat", S_IRUGO, tgid_stat), | 2505 | ONE("stat", S_IRUGO, tgid_stat), |
2478 | ONE("statm", S_IRUGO, pid_statm), | 2506 | ONE("statm", S_IRUGO, pid_statm), |
@@ -2805,6 +2833,9 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2805 | #ifdef CONFIG_SCHED_DEBUG | 2833 | #ifdef CONFIG_SCHED_DEBUG |
2806 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), | 2834 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), |
2807 | #endif | 2835 | #endif |
2836 | #ifdef CONFIG_HAVE_ARCH_TRACEHOOK | ||
2837 | INF("syscall", S_IRUSR, pid_syscall), | ||
2838 | #endif | ||
2808 | INF("cmdline", S_IRUGO, pid_cmdline), | 2839 | INF("cmdline", S_IRUGO, pid_cmdline), |
2809 | ONE("stat", S_IRUGO, tid_stat), | 2840 | ONE("stat", S_IRUGO, tid_stat), |
2810 | ONE("statm", S_IRUGO, pid_statm), | 2841 | ONE("statm", S_IRUGO, pid_statm), |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index bc0a0dd2d844..cb4096cc3fb7 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -806,12 +806,9 @@ continue_removing: | |||
806 | if (S_ISDIR(de->mode)) | 806 | if (S_ISDIR(de->mode)) |
807 | parent->nlink--; | 807 | parent->nlink--; |
808 | de->nlink = 0; | 808 | de->nlink = 0; |
809 | if (de->subdir) { | 809 | WARN(de->subdir, KERN_WARNING "%s: removing non-empty directory " |
810 | printk(KERN_WARNING "%s: removing non-empty directory " | ||
811 | "'%s/%s', leaking at least '%s'\n", __func__, | 810 | "'%s/%s', leaking at least '%s'\n", __func__, |
812 | de->parent->name, de->name, de->subdir->name); | 811 | de->parent->name, de->name, de->subdir->name); |
813 | WARN_ON(1); | ||
814 | } | ||
815 | if (atomic_dec_and_test(&de->count)) | 812 | if (atomic_dec_and_test(&de->count)) |
816 | free_proc_entry(de); | 813 | free_proc_entry(de); |
817 | } | 814 | } |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 02eca2ed9dd7..b37f25dc45a5 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -94,7 +94,7 @@ static void proc_destroy_inode(struct inode *inode) | |||
94 | kmem_cache_free(proc_inode_cachep, PROC_I(inode)); | 94 | kmem_cache_free(proc_inode_cachep, PROC_I(inode)); |
95 | } | 95 | } |
96 | 96 | ||
97 | static void init_once(struct kmem_cache * cachep, void *foo) | 97 | static void init_once(void *foo) |
98 | { | 98 | { |
99 | struct proc_inode *ei = (struct proc_inode *) foo; | 99 | struct proc_inode *ei = (struct proc_inode *) foo; |
100 | 100 | ||