[PATCH v2] remote_daemon: Don't run virStateCleanup() if virStateReload() is still running

Martin Kletzander mkletzan at redhat.com
Mon May 23 11:35:02 UTC 2022


On Thu, May 19, 2022 at 04:49:32PM +0200, Michal Privoznik wrote:
>When a SIGHUP is received a thread is spawned that runs
>virStateReload(). However, if SIGINT is received while the former
>thread is still running then we may get into problematic
>situation: the cleanup code in main() sees drivers initialized
>and thus calls virStateCleanup(). So now we have two threads, one
>running virStateReload() the other virStateCleanup(). In this
>situation it's very likely that a race condition occurs and
>either of threads causes SIGSEGV.
>
>To fix this, unmark drivers as initialized in the
>virStateReload() thread for the time the function runs.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075837
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>

>---
>
>v2 of:
>
>https://listman.redhat.com/archives/libvir-list/2022-April/230415.html
>
>diff to v1:
>- reworked how int is set (instead of inc/dec I'm using set(0)/set(1))
>so that reload can be attempted again and again if previous attempt
>failed.
>

Looks perfect, thanks for taking the time to work my suggestions in.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220523/534fba63/attachment.sig>


More information about the libvir-list mailing list