[libvirt] [PATCH 2/2] qemu: Avoid operations on NULL monitor if VM fails early

Peter Krempa pkrempa at redhat.com
Wed Jan 15 17:10:16 UTC 2014


On 01/15/14 17:45, Michal Privoznik wrote:
> On 14.01.2014 19:31, Peter Krempa wrote:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1047659
>>
>> If a VM dies very early during an attempted connect to the guest agent
>> while the locks are down the domain monitor object will be freed. The
>> object is then accessed later as any failure during guest agent startup
>> isn't considered fatal.
>>
>> In the current upstream version this doesn't lead to a crash as
>> virObjectLock called when entering the monitor in
>> qemuProcessDetectVcpuPIDs checks the pointer before attempting to
>> dereference (lock) it. The NULL pointer is then caught in the monitor
>> helper code.
>>
>> Before the introduction of virObjectLockable - observed on 0.10.2 - the
>> pointer is locked directly via virMutexLock leading to a crash.
>>
>> To avoid this problem we need to differentiate between the guest agent
>> not being present and the VM quitting when the locks were down. The fix
>> reorganizes the code in qemuConnectAgent to add the check and then adds
>> special handling to the callers.
>> ---
>>  src/qemu/qemu_process.c | 34 +++++++++++++++++++++++++---------
>>  1 file changed, 25 insertions(+), 9 deletions(-)
>>
> 
> ACK and safe for 1.2.1.
> 
> Michal
> 

Pushed; Thanks.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140115/2613a841/attachment-0001.sig>


More information about the libvir-list mailing list