Oleg Nesterov
2023-May-24 14:10 UTC
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
On 05/23, Eric W. Biederman wrote:> > I want to point out that we need to consider not just SIGKILL, but > SIGABRT that causes a coredump, as well as the process peforming > an ordinary exit(2). All of which will cause get_signal to return > SIGKILL in this context.Yes, but probably SIGABRT/exit doesn't really differ from SIGKILL wrt vhost_worker().> It is probably not the worst thing in the world, but what this means > is now if you pass a copy of the vhost file descriptor to another > process the vhost_worker will persist, and thus the process will persist > until that copy of the file descriptor is closed.Hadn't thought about it. I am fighting with internal bugzillas today, will try to write another email tomorrow. But before that, I would like to have an answer to my "main" question in my previois email. Otherwise I am still not sure I understand what exactly we need to fix. Oleg.
Eric W. Biederman
2023-May-24 14:44 UTC
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
Oleg Nesterov <oleg at redhat.com> writes:> On 05/23, Eric W. Biederman wrote: >> >> I want to point out that we need to consider not just SIGKILL, but >> SIGABRT that causes a coredump, as well as the process peforming >> an ordinary exit(2). All of which will cause get_signal to return >> SIGKILL in this context. > > Yes, but probably SIGABRT/exit doesn't really differ from SIGKILL wrt > vhost_worker().Actually I think it reveals that exiting with SIGABRT will cause a deadlock. coredump_wait will wait for all of the threads to reach coredump_task_exit. Meanwhile vhost_worker is waiting for all of the other threads to reach exit_files to close their file descriptors. So it looks like the final pieces of work will actually need to be moved into to vhost_xxx_flush or vhost_xxx_release to avoid the exiting threads from waiting on each other, instead of depending upon the vhost_worker to do the work. Which gets back to most of your other questions.>> It is probably not the worst thing in the world, but what this means >> is now if you pass a copy of the vhost file descriptor to another >> process the vhost_worker will persist, and thus the process will persist >> until that copy of the file descriptor is closed. > > Hadn't thought about it. > > I am fighting with internal bugzillas today, will try to write another > email tomorrow. > > But before that, I would like to have an answer to my "main" question in > my previois email. Otherwise I am still not sure I understand what exactly > we need to fix.Let me repeat your "main" question just for clarity here. If a signal comes in after the signal_pending check but before the "work->fn(work)" call is "work->fn(work)" expected to run correctly with signal_pending() or fatal_signal_pending returning true? Eric