* [PATCH] ptrace: allow to ptrace /sbin/init
@ 2008-03-26 20:16 Oleg Nesterov
2008-03-26 20:40 ` Roland McGrath
2008-03-27 7:20 ` Pavel Emelyanov
0 siblings, 2 replies; 3+ messages in thread
From: Oleg Nesterov @ 2008-03-26 20:16 UTC (permalink / raw)
To: Andrew Morton
Cc: Andi Kleen, Eric W. Biederman, Herbert Poetzl, Krzysztof Halasa,
Pavel Emelyanov, Pavel Machek, Serge E. Hallyn, Stephen Smalley,
Roland McGrath, linux-kernel
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>
--- 25/kernel/ptrace.c~INIT_PTRACEABLE 2008-03-26 21:31:39.000000000 +0300
+++ 25/kernel/ptrace.c 2008-03-26 21:33:35.000000000 +0300
@@ -168,8 +168,6 @@ int ptrace_attach(struct task_struct *ta
audit_ptrace(task);
retval = -EPERM;
- if (task->pid <= 1)
- goto out;
if (same_thread_group(task, current))
goto out;
@@ -517,12 +515,6 @@ struct task_struct *ptrace_get_task_stru
{
struct task_struct *child;
- /*
- * Tracing init is not allowed.
- */
- if (pid == 1)
- return ERR_PTR(-EPERM);
-
read_lock(&tasklist_lock);
child = find_task_by_vpid(pid);
if (child)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ptrace: allow to ptrace /sbin/init
2008-03-26 20:16 [PATCH] ptrace: allow to ptrace /sbin/init Oleg Nesterov
@ 2008-03-26 20:40 ` Roland McGrath
2008-03-27 7:20 ` Pavel Emelyanov
1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2008-03-26 20:40 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Andi Kleen, Eric W. Biederman, Herbert Poetzl,
Krzysztof Halasa, Pavel Emelyanov, Pavel Machek, Serge E. Hallyn,
Stephen Smalley, linux-kernel
Fine by me!
Acked-by: Roland McGrath <roland@redhat.com>
Thanks,
Roland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptrace: allow to ptrace /sbin/init
2008-03-26 20:16 [PATCH] ptrace: allow to ptrace /sbin/init Oleg Nesterov
2008-03-26 20:40 ` Roland McGrath
@ 2008-03-27 7:20 ` Pavel Emelyanov
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Emelyanov @ 2008-03-27 7:20 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Andi Kleen, Eric W. Biederman, Herbert Poetzl,
Krzysztof Halasa, Pavel Machek, Serge E. Hallyn, Stephen Smalley,
Roland McGrath, linux-kernel
Oleg Nesterov wrote:
> 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: Pavel Emelyanov <xemul@openvz.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-27 7:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 20:16 [PATCH] ptrace: allow to ptrace /sbin/init Oleg Nesterov
2008-03-26 20:40 ` Roland McGrath
2008-03-27 7:20 ` Pavel Emelyanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox