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

From: Oleg Nesterov
Date: Mon May 30 2011 - 09:57:57 EST


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.

--
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/