[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] qemu-ga: possible race while suspending the guest
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] qemu-ga: possible race while suspending the guest |
Date: |
Mon, 9 Apr 2012 16:57:48 -0300 |
Hi Michael,
There's a possible race condition in the bios_supports_mode() function used
by all suspend commands in qemu-ga: if the parent process receives a SIGCHLD
while executing:
close(pipefds[1]);
g_free(pmutils_path);
Or:
ret = read(pipefds[0], &status, sizeof(status));
Then bad things can happen, like reporting that the guest doesn't support
suspend or a resource leak (a segfault may be possible too).
The easy & obvious way to fix this is just to block SIGCLHD while in close()
and g_free() and to loop read() on EINTR.
However, the real problem here is that the double fork schema used in the
suspend commands got complex. It's this way because I was trying to avoid
causing a conflict with your series that adds support for running commands
in the guest.
The ideal solution is to add an internal API to qemu-ga to create & wait for
child processes, like we discussed during the suspend commands review.
Now, what it's best way to go with this bug? Should I fix it the easy way
or should I wait for the new API (which I believe you're going to work on)?
Thanks.
- [Qemu-devel] qemu-ga: possible race while suspending the guest,
Luiz Capitulino <=