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

Michal Privoznik mprivozn at redhat.com
Wed Jan 15 16:45:10 UTC 2014


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




More information about the libvir-list mailing list