Red Hat Bugzilla – Bug 805533
qemu-ga: possible race while suspending the guest
Last modified: 2013-10-15 10:08:22 EDT
During qemu-ga patch review it was found that there's a possible race in the code used to detect if the guest supports suspend. No suspend support could be erroneously reported when the race is triggered.
The code in question is in bios_supports_mode() function. Theoretically, the following calls could be interrupted if one of the children created by bios_supports_mode() exits - or other children created by qemu-ga, although no other code that could run in parallel with bios_supports_mode() does that today:
ret = read(pipefds, &status, sizeof(status));
The quick & easy solution for RHEL6.3 is to loop read() on EINTR error and block SIGCHLD during the close() and g_free() functions.
The Right solution for upstream is to add a general interface to create & safely wait for children to terminate. This would also simplify the suspend functions.
Corner case on a tech-preview feature, postponing to 6.4.
Took this upstream and the recommendation is to implement the easy fix:
This is doable for 6.3, but I agree it's a corner case.
After some discussion, we decided to make the guest-suspend-* commands synchronous. This just drops the need for the SIGCHLD signal, which automatically ends up fixing this issue.
Patches submitted some days ago and already included in Michael Roth's latest pull request:
As far as testing is concerned, this issue was found in code review and is theoretical. There's no recipe to trigger it. So I think verification should be skipped.
Checked on qemu-kvm-0.12.1.2-2.337.el6, the codes indeed included according to changelog.
#rpm -q qemu-kvm-0.12.1.2-2.337.el6 --changelog | grep 805533
- Update information: Add bug 805533 information to changelog (fix for 827612 fixed also 805533)
- Resolves: bz#805533
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
Do we need clone this bug to RHEL7 product?
No, this is a very old issue fixed since qemu v1.1.0, but thanks for checking.