Re: [RFC][PATCH] exec: Freeze the other threads during a multi-threaded exec

From: Linus Torvalds
Date: Tue Jul 28 2020 - 14:17:24 EST

On Tue, Jul 28, 2020 at 6:23 AM Eric W. Biederman <ebiederm@xxxxxxxxxxxx> wrote:
> For exec all I care about are user space threads. So it appears the
> freezer infrastructure adds very little.

Yeah. 99% of the freezer stuff is for just adding the magic notations
for kernel threads, and for any user space threads it seems the wrong

> Now to see if I can find another way to divert a task into a slow path
> as it wakes up, so I don't need to manually wrap all of the sleeping
> calls. Something that plays nice with the scheduler.

The thing is, how many places really care?

Because I think there are like five of them. And they are all marked
by taking cred_guard_mutex, or the file table lock.

So it seems really excessive to then create some whole new "let's
serialize every thread", when you actually don't care about any of it,
except for a couple of very very special cases.

If you care about "thread count stable", you care about exit() and
clone(). You don't care about threads that are happily running - or
sleeping - doing their own thing.

So trying to catch those threads and freezing them really feels like
entirely the wrong interface.