Patchwork Fix semaphores fallback code

login
register
mail settings
Submitter Brad
Date Dec. 28, 2012, 6 a.m.
Message ID <20121228060022.GB27232@rox.home.comstyle.com>
Download mbox | patch
Permalink /patch/208414/
State New
Headers show

Comments

Brad - Dec. 28, 2012, 6 a.m.
As reported in bug 1087114 the semaphores fallback code is broken which
results in QEMU crashing and making QEMU unusable.

This patch is from Paolo.

This needs to be back ported to the 1.3 stable tree as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Brad Smith <brad@comstyle.com>
Blue Swirl - Dec. 28, 2012, 8:13 p.m.
On Fri, Dec 28, 2012 at 6:00 AM, Brad Smith <brad@comstyle.com> wrote:
> As reported in bug 1087114 the semaphores fallback code is broken which
> results in QEMU crashing and making QEMU unusable.
>
> This patch is from Paolo.
>
> This needs to be back ported to the 1.3 stable tree as well.

Needs to be back ported to HEAD as well because of the reorganization,
or applied after Paolo's series.

>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Brad Smith <brad@comstyle.com>
>
>
> diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
> index 7be292e..17f2d7c 100644
> --- a/util/qemu-thread-posix.c
> +++ b/util/qemu-thread-posix.c
> @@ -213,6 +213,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms)
>      while (sem->count < 0) {
>          rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts);
>          if (rc == ETIMEDOUT) {
> +            ++sem->count;
>              break;
>          }
>          if (rc != 0) {
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
Blue Swirl - Dec. 29, 2012, 3:49 p.m.
Thanks, applied.

On Fri, Dec 28, 2012 at 6:00 AM, Brad Smith <brad@comstyle.com> wrote:
> As reported in bug 1087114 the semaphores fallback code is broken which
> results in QEMU crashing and making QEMU unusable.
>
> This patch is from Paolo.
>
> This needs to be back ported to the 1.3 stable tree as well.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Brad Smith <brad@comstyle.com>
>
>
> diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
> index 7be292e..17f2d7c 100644
> --- a/util/qemu-thread-posix.c
> +++ b/util/qemu-thread-posix.c
> @@ -213,6 +213,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms)
>      while (sem->count < 0) {
>          rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts);
>          if (rc == ETIMEDOUT) {
> +            ++sem->count;
>              break;
>          }
>          if (rc != 0) {
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>

Patch

diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 7be292e..17f2d7c 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -213,6 +213,7 @@  int qemu_sem_timedwait(QemuSemaphore *sem, int ms)
     while (sem->count < 0) {
         rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts);
         if (rc == ETIMEDOUT) {
+            ++sem->count;
             break;
         }
         if (rc != 0) {