[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230605134844.GC32275@redhat.com>
Date: Mon, 5 Jun 2023 15:48:44 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Mike Christie <michael.christie@...cle.com>
Cc: linux@...mhuis.info, nicolas.dichtel@...nd.com, axboe@...nel.dk,
ebiederm@...ssion.com, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, mst@...hat.com,
sgarzare@...hat.com, jasowang@...hat.com, stefanha@...hat.com,
brauner@...nel.org
Subject: Re: [PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps
regression
On 06/01, Mike Christie wrote:
>
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1368,7 +1368,9 @@ int zap_other_threads(struct task_struct *p)
>
> while_each_thread(p, t) {
> task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK);
> - count++;
> + /* Don't require de_thread to wait for the vhost_worker */
> + if ((t->flags & (PF_IO_WORKER | PF_USER_WORKER)) != PF_USER_WORKER)
> + count++;
Well if you do this, then you should also change __exit_signal() to
not decrement sig->notify_count. Otherwise de_thread() can succeed
before the "normal" sub-threads exit.
But this can't be right anyway... If nothing else, suppose we have
a process with 3 threads:
M - the main thread, group leader
T - sub-thread
V - vhost worker
T does exec and calls de_thread().
M exits. T takes the leadership and does release_task()
V is still running but V->group_leader points to already freed M.
Or unshare_sighand() after that... If nothing else this means that
lock_task_sighand(T) and lock_task_sighand(V) will take different
locks.
Oleg.
Powered by blists - more mailing lists