Qemu 1:6.2+dfsg-2ubuntu6 deadlock bug

Bug #1970563 reported by xp
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qemu (Ubuntu)
Fix Released
High
Christian Ehrhardt 
Jammy
Fix Released
Medium
Christian Ehrhardt 
Kinetic
Fix Released
High
Christian Ehrhardt 

Bug Description

[Impact]

 * A deadlock in the connect/disconnect code is present in qemu 6.2

 * backport the fix which moves the unlock a bit to avoid racing with
   a lock triggered by clipboard unregistration. For more see the
   referenced upstream commit

[Test Plan]

 * start a qemu wit hvnc
   qemu-system-x86_64 -vnc 127.0.0.1:0 ...

 * Connect and disconnect with VNC against it (TigerVNC is known
   to work for this repro). You might wait a while in between

 * Without the fix at some point a race will occur which deadlocks qemu -
   no interaction is possible anymore.

[Where problems could occur]

 * Lock changes are always scary, but this one isn't too complex.
   It is not rewriting all of it, just moving it up a few lines so
   that qemu_clipboard_peer_unregister no mor is in its scope.
   I can think of a problem if we'd find out later that inside of
   that call we would have needed the lock to be held already.
   It seems that isn't the case (it grabs the lock where needed),
   but that is the issue I could think of. If that would happen it
   would more likely then not be a deadlock but instead accessing
   unsafe data which could lead to a variety of symptoms that are
   hard to predict.

[Other Info]

 * n/a

--- original bug ---

There is a known bug that will cause VM deadlock, the patch should be merged and released:

https://gitlab.com/qemu-project/qemu/-/commit/1dbbe6f172810026c51dc84ed927a3cc23017949#841723aa93098d8ab3b5068795e10ae7cf2a3179

Related branches

Revision history for this message
Paride Legovini (paride) wrote :

That's clearly a fix for a bug, but I couldn't identify an upstream issue which describes the problem. The commit message has:

  Fixes: 0bf41cab

but that's a reference to another commit, not to an issue. Finding original description of the bug would help identifying a test case for the SRU.

@xp are you able to point us to the upstream bug report, or to provide steps to reproduce the issue which we can use to verify the fix?

I'm marking this as Incomplete for now because the description of the problem is too vague, but I think this will become a valid SRU case.

Revision history for this message
xp (xiongpeng) wrote :

This should be the upstream bug report:
https://gitlab.com/qemu-project/qemu/-/issues/807

Paride Legovini (paride)
no longer affects: qemu
Revision history for this message
Paride Legovini (paride) wrote :

Thanks, that report also has nice steps to reproduce. I updated the bug tags/status accordingly.

summary: - Qemu Debian 1:6.2+dfsg-2ubuntu6 deadlock bug
+ Qemu 1:6.2+dfsg-2ubuntu6 deadlock bug
no longer affects: qemu
Changed in qemu (Ubuntu):
status: New → Triaged
tags: added: server-todo
Revision history for this message
xp (xiongpeng) wrote :

Thanks

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

From the description this bug affects Jammy and Kinetic, so I added explicit tasks for each series.

Changed in qemu (Ubuntu Jammy):
status: New → Triaged
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks this is great pre-work and a patch on a plate.
I was pondering if I should wait until we merge qemu 7.0 for kintic, but that would delay this too much.

I still need to find some time, but I'll prepare and upload the fix without waiting for 7.0.

Changed in qemu (Ubuntu Jammy):
assignee: nobody → Christian Ehrhardt  (paelzer)
Changed in qemu (Ubuntu Kinetic):
assignee: nobody → Christian Ehrhardt  (paelzer)
importance: Undecided → High
Changed in qemu (Ubuntu Jammy):
importance: Undecided → Medium
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
description: updated
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for the Review Sergio.

Uploaded the fix for Kinetic.
We can start the SRU to jammy once it is complete there.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:6.2+dfsg-2ubuntu7

---------------
qemu (1:6.2+dfsg-2ubuntu7) kinetic; urgency=medium

  * d/p/u/lp-1970563-ui-vnc.c-Fixed-a-deadlock-bug.patch: avoid deadlock
    in vnc connections (LP: #1970563)

 -- Christian Ehrhardt <email address hidden> Thu, 19 May 2022 08:25:20 +0200

Changed in qemu (Ubuntu Kinetic):
status: Triaged → Fix Released
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Completed in Kinetic, uploaded to Jammy now - waiting for the SRU team to have a look

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello xp, or anyone else affected,

Accepted qemu into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:6.2+dfsg-2ubuntu6.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in qemu (Ubuntu Jammy):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (qemu/1:6.2+dfsg-2ubuntu6.1)

All autopkgtests for the newly accepted qemu (1:6.2+dfsg-2ubuntu6.1) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

vagrant-mutate/1.2.0-4.1 (s390x, ppc64el)
livecd-rootfs/2.764 (arm64, ppc64el)
ubuntu-image/2.2+22.04ubuntu3 (arm64, s390x)
sbuild/0.81.2ubuntu6 (s390x, ppc64el)
edk2/2022.02-3 (armhf)
initramfs-tools/0.140ubuntu13 (amd64)
systemd/249.11-0ubuntu3.1 (ppc64el)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI: Autopkgtest issues resolved, but verification of the upload for the presented problem is needed.

@XP - it is always best to do this in the original reported environment - do you think you could do that verification?

Revision history for this message
xp (xiongpeng) wrote :

Sure, This my test steps:
* start a qemu wit qemu vnc
   qemu-system-x86_64 -vnc 127.0.0.1:0 ...

* Connect and disconnect and connect with VNC against it (We use novnc).

* when qemu-system-x86 1:6.2+dfsg-2ubuntu6
 occur which deadlocks qemu - no interaction is possible anymore

* upgrade to qemu-system-x86/jammy-proposed 1:6.2+dfsg-2ubuntu6.1
    Connect and disconnect and connect, everything is ok, no more deadlock

The bug has been fixed, thank you.

tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Perfect, thank you Xiongpeng!

tags: added: verification-done
removed: verification-needed
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for qemu has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:6.2+dfsg-2ubuntu6.1

---------------
qemu (1:6.2+dfsg-2ubuntu6.1) jammy; urgency=medium

  * d/p/u/lp-1970563-ui-vnc.c-Fixed-a-deadlock-bug.patch: avoid deadlock
    in vnc connections (LP: #1970563)

 -- Christian Ehrhardt <email address hidden> Thu, 19 May 2022 08:25:20 +0200

Changed in qemu (Ubuntu Jammy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.