Re: [PATCH 10/11] ptrace: move JOBCTL_TRAPPING wait to wait(2) andptrace_check_attach()

From: Oleg Nesterov
Date: Fri May 13 2011 - 14:35:47 EST


On 05/13, Tejun Heo wrote:
>
> On Thu, May 12, 2011 at 08:20:06PM +0200, Oleg Nesterov wrote:
> > Now about GROUP_STOP_TRAPPING. To simplify the discussion, lets
> > forget about this series,
> >
> > ...
> >
> > Problem: TRAPPING can be set outside of do_signal_stop() paths, and
> > I think we should avoid this as much as possible.
>
> For PTRACE_DETACH, this was true but it isn't true for notification
> re-traps. Notification re-traps happen iff JOBCTL_TRAPPED

Yes I see, and task_clear_jobctl_trapping() was moved into
get_signal_to_deliver().

So, if we return to this series then "outside of do_signal_stop()" is
not accurate.

> > (I am ignoring the problem this patch addresses temporary, I think
> > we can fix it a bit differently).
>
> Just leaving it alone also is an option. We can just mandate
> ptrace(2) users to always perform sleeping wait(2) after PTRACE_SEIZE.
> If it can be fixed easily, sure. If not, let's leave it alone.

Let's leave it alone in this thread, unless I missed something this is
simple. Or I missed something and it is not that simple ;)

> > Say, the thread group was stopped, the tracer PTRACE_CONT's T1, it calls
> > sys_execve() and reports the trap from syscall_trace_enter().
> >
> > The tracer does ptrace(T1, DETACH) + ptrace(T1, SEIZE) and hangs forever.
> >
> > Once again, this is only one example. coredump, vfork, probably something
> > else. In short: I think that TRAPPING-outside-of-do_signal_stop is the
> > can of worms.
>
> Yeap, fully agreed. We need something different for detach case;
> however, for re-trap, tracee is known to be in signal delivery path
> and should be okay, I think. Right?

I think this is right, but there were so many issues, that is why I
suggested to ignore this series temporary. And, to be honest, because
I was a bit confused, somehow I thought you are going to add more
TRAPPING's.

So, we agree that we can only set TRAPPING iff we know what the tracee
should do "really soon". Great.

I have other concerns, but I noticed you have already sent V2. Let's
continue there.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/