mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 05:11:46 +00:00
tracehook: tracehook_tracer_task
This adds the tracehook_tracer_task() hook to consolidate all forms of "Who is using ptrace on me?" logic. This is used for "TracerPid:" in /proc and for permission checks. We also clean up the selinux code the called an identical accessor. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Reviewed-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
dae33574dc
commit
0d094efeb1
4 changed files with 37 additions and 25 deletions
|
@ -80,6 +80,7 @@
|
|||
#include <linux/delayacct.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/pid_namespace.h>
|
||||
#include <linux/tracehook.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/processor.h>
|
||||
|
@ -168,8 +169,12 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
|
|||
rcu_read_lock();
|
||||
ppid = pid_alive(p) ?
|
||||
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
|
||||
tpid = pid_alive(p) && p->ptrace ?
|
||||
task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0;
|
||||
tpid = 0;
|
||||
if (pid_alive(p)) {
|
||||
struct task_struct *tracer = tracehook_tracer_task(p);
|
||||
if (tracer)
|
||||
tpid = task_pid_nr_ns(tracer, ns);
|
||||
}
|
||||
seq_printf(m,
|
||||
"State:\t%s\n"
|
||||
"Tgid:\t%d\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue