Re: [PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression

From: Christian Brauner
Date: Tue May 30 2023 - 10:16:33 EST


On Mon, May 29, 2023 at 01:19:39PM +0200, Oleg Nesterov wrote:
> On 05/27, Eric W. Biederman wrote:
> >
> > Looking forward I don't see not asking the worker threads to stop
> > for the coredump right now causing any problems in the future.
> > So I think we can use this to resolve the coredump issue I spotted.
>
> But we have almost the same problem with exec.
>
> Execing thread will wait for vhost_worker() while vhost_worker will wait for
> .release -> vhost_task_stop().
>
> And even O_CLOEXEC won't help, do_close_on_exec() is called after de_thread().
>
> Or suppose that vhost_worker's sub-thread forks a child with CLONE_FILES...
>
> If we want CLONE_THREAD, I think vhost_worker() should exit after get_signal()
> returns SIGKILL. Perhaps it should "disable" vhost_work_queue() somehow and

Yes, and that's what I proposed at the beginning of this tread. We want
to have similar behavior as io_uring and cancel any oustanding work
instead of trying to finish it. But Mike was concerned because this
might be a change in behavior. Which I think is fine though. And it
complicates the code if we want to finish any outstanding work.