Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00cd5c37 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

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: default avatarOleg Nesterov <oleg@tv-sign.ru>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Acked-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 33e9fc7d
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -168,8 +168,6 @@ int ptrace_attach(struct task_struct *task)
	audit_ptrace(task);
	audit_ptrace(task);


	retval = -EPERM;
	retval = -EPERM;
	if (task->pid <= 1)
		goto out;
	if (same_thread_group(task, current))
	if (same_thread_group(task, current))
		goto out;
		goto out;


@@ -521,12 +519,6 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
{
{
	struct task_struct *child;
	struct task_struct *child;


	/*
	 * Tracing init is not allowed.
	 */
	if (pid == 1)
		return ERR_PTR(-EPERM);

	read_lock(&tasklist_lock);
	read_lock(&tasklist_lock);
	child = find_task_by_vpid(pid);
	child = find_task_by_vpid(pid);
	if (child)
	if (child)