aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-04-30 03:53:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:38 -0400
commit00cd5c37afd5f431ac186dd131705048c0a11fdb (patch)
treed5412f6c720e2cee11ac66783bb45e6bd78f4a1d /kernel
parent33e9fc7d01269737cd5a3b6de1db9d0e796ab708 (diff)
ptrace: permit ptracing of /sbin/init
Afaics, currently there are no kernel problems with ptracing init, it can't lose SIGNAL_UNKILLABLE flag and be killed/stopped by accident. The ability to strace/debug init can be very useful if you try to figure out why it does not work as expected. However, admin should know what he does, "gdb /sbin/init 1" stops init, it can't reap orphaned zombies or take care of /etc/inittab until continued. It is even possible to crash init (and thus the whole system) if you wish, ptracer has full control. See also the long discussion: http://marc.info/?t=120628018600001 Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Acked-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ptrace.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 5f8d452e8111..dcc199c43a12 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -168,8 +168,6 @@ int ptrace_attach(struct task_struct *task)
168 audit_ptrace(task); 168 audit_ptrace(task);
169 169
170 retval = -EPERM; 170 retval = -EPERM;
171 if (task->pid <= 1)
172 goto out;
173 if (same_thread_group(task, current)) 171 if (same_thread_group(task, current))
174 goto out; 172 goto out;
175 173
@@ -521,12 +519,6 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
521{ 519{
522 struct task_struct *child; 520 struct task_struct *child;
523 521
524 /*
525 * Tracing init is not allowed.
526 */
527 if (pid == 1)
528 return ERR_PTR(-EPERM);
529
530 read_lock(&tasklist_lock); 522 read_lock(&tasklist_lock);
531 child = find_task_by_vpid(pid); 523 child = find_task_by_vpid(pid);
532 if (child) 524 if (child)