Re: execve-under-ptrace API bug (was Re: Ptrace documentation, draft #3)

Oleg Nesterov
2011-05-30T13:57:54Z

On 05/30, Tejun Heo wrote:
>
> A problem is that by the time de-threading is in progress, it's
> already too deep and there's no way back and the exec'ing thread has
> to wait for completion in uninterruptible sleeps - ie. it expects
> de-threading to finish in finite amount of time and to achieve that it
> basically sends SIGKILL to all other threads. If we introduce a trap
> in de-threading itself, we can easily end up with an unkillable
> task.

"unkillable" is not the problem, afaics. But the new trap is problematic,
we do not want the TASK_TRACED task holding the mutexes taken by the
callers of de_thread.

> 1. Don't allow more than one thread in the same group enter exec(2)
> path at all.

This is already done, see do_execve()->prepare_bprm_creds().
cred_guard_mutex serializes exec. Btw, probably this allows us to do
more cleanups/simplifications in do_execve() paths.

> 2. Add another trap point right before de-threading commences.

See above.

Oleg.