[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110530192255.GB20616@redhat.com>
Date: Mon, 30 May 2011 21:22:55 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: Denys Vlasenko <vda.linux@...glemail.com>,
jan.kratochvil@...hat.com, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
indan@....nu, bdonlan@...il.com
Subject: Re: [PATCH 03/10] ptrace: implement PTRACE_SEIZE
On 05/27, Tejun Heo wrote:
>
> On Thu, May 26, 2011 at 05:01:50PM +0200, Oleg Nesterov wrote:
> > On 05/26, Tejun Heo wrote:
> > > > Or we can change do_wait() to detach a zombie leader. In this case it
> > > > is not clear what should we do if the debugger is the real parent.
> > > > Perhaps do_wait() should do the same: detach a leader (but not reap).
> > > > When the last thread does, the real parent will be notified again.
> > > > IOW, wait(tgid) can succeed twice.
> > >
> > > Just letting PTRACE_DETACH work for zombies sounds much simpler to me.
> >
> > Probably, but please note we have to modify do_wait() anyway. Otherwise
> > in general the tracer simply can not know the tracee has exited. IOW,
> > waitpid(zombie_leader_pid, WEXITED) should succeed without reaping if
> > delay_group_leader(), then the tracer can do PTRACE_DETACH. But this is
> > not symmetrical with sub-thread zombies.
>
> Yes, complicated. The task/process duality conflicts. wait(2)
> already is different for group leader and succeeds twice for the
> ptracer and the real parent (when they're different).
>
> If we relocate ptrace group leader zombie wait, as suggested, such
> that it waits for the task itself rather than the whole group, we
> would be taking away a feature - ptracer waiting for the whole process
Partly yes. The parent will be notified again and it can do another
wait() later. The problem is, this is confusing.
> I think group leader wait becoming asymmetrical with sub-thread
> zombies is perfectly fine - it already is.
Well, probably yes... But why? We have to change do_wait() anyway to
report the death of the leader. If we do this, we can detach it as
well.
> But would it be okay to
> change ptrace wait(2) on group leader to wait for the task itself
> rather than the whole group?
Yes, this is iffy. Simply because this can confuse the userspace.
May be we can add W_PTRACED_THREAD_EXITED? (should be used instead
of WEXITED by ptracer). Or, perhaps WEXITED should succeed but put
something special into status?
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists