All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: Another VNC crash, qemu-kvm-0.12.3
Date: Fri, 5 Mar 2010 16:52:09 +0000	[thread overview]
Message-ID: <20100305165209.GL29711@arachsys.com> (raw)
In-Reply-To: <4B8E70DB.4080108@codemonkey.ws>

Anthony Liguori <anthony@codemonkey.ws> writes:

> On 03/01/2010 12:14 PM, Chris Webb wrote:
> >We've just seen another VNC related qemu-kvm crash, this time an arithmetic
> >exception at vnc.c:1424 in the newly release qemu-kvm 0.12.3.
> >
> >   [...]
> >   1423     if (vs->absolute) {
> >   1424         kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
> >   1425                         y * 0x7FFF / (ds_get_height(vs->ds) - 1),
> >   1426                         dz, buttons);
> >   1427     } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
> >   1428         x -= 0x7FFF;
> >   [...]
> >
> >and sure enough:
> >
> >   (gdb) p vs->ds->surface->width
> >   $1 = 9
> >   (gdb) p vs->ds->surface->height
> >   $2 = 1
> >
> >What a 9x1 display surface is doing on this guest is a mystery to me, but you
> >definitely can't divide by one less than its height!
> 
> Can you reproduce this reliably?  If so, what's the procedure?

No, I'm afraid not, although I have had a thorough play myself with a variety
of VNC clients in an attempt to reproduce.

The background here is that we're running a public hosting service where
customers can install and run their own OSes on their own qemu-kvm virtual
machines. I don't even know what VNC client (if any) was connected at the
time. I only see the core dump if the qemu-kvm crashes.

Of course, if the screen width or height is 1, it doesn't really matter what
the value of the mouse position for the click is, so something as simple as

diff --git a/vnc.c b/vnc.c
--- a/vnc.c
+++ b/vnc.c
@@ -1421,8 +1421,10 @@
         dz = 1;
 
     if (vs->absolute) {
-        kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
-                        y * 0x7FFF / (ds_get_height(vs->ds) - 1),
+        kbd_mouse_event(ds_get_width(vs->ds) > 1 ?
+                          x * 0x7FFF / (ds_get_width(vs->ds) - 1) : 0x4000,
+                        ds_get_height(vs->ds) > 1 ?
+                          y * 0x7FFF / (ds_get_height(vs->ds) - 1) : 0x4000,
                         dz, buttons);
     } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
         x -= 0x7FFF;

will fix the symptom: the division by zero. The underlying cause of a 9x1
display surface is a bit mysterious though.

Cheers,

Chris.

WARNING: multiple messages have this Message-ID (diff)
From: Chris Webb <chris@arachsys.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: Another VNC crash, qemu-kvm-0.12.3
Date: Fri, 5 Mar 2010 16:52:09 +0000	[thread overview]
Message-ID: <20100305165209.GL29711@arachsys.com> (raw)
In-Reply-To: <4B8E70DB.4080108@codemonkey.ws>

Anthony Liguori <anthony@codemonkey.ws> writes:

> On 03/01/2010 12:14 PM, Chris Webb wrote:
> >We've just seen another VNC related qemu-kvm crash, this time an arithmetic
> >exception at vnc.c:1424 in the newly release qemu-kvm 0.12.3.
> >
> >   [...]
> >   1423     if (vs->absolute) {
> >   1424         kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
> >   1425                         y * 0x7FFF / (ds_get_height(vs->ds) - 1),
> >   1426                         dz, buttons);
> >   1427     } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
> >   1428         x -= 0x7FFF;
> >   [...]
> >
> >and sure enough:
> >
> >   (gdb) p vs->ds->surface->width
> >   $1 = 9
> >   (gdb) p vs->ds->surface->height
> >   $2 = 1
> >
> >What a 9x1 display surface is doing on this guest is a mystery to me, but you
> >definitely can't divide by one less than its height!
> 
> Can you reproduce this reliably?  If so, what's the procedure?

No, I'm afraid not, although I have had a thorough play myself with a variety
of VNC clients in an attempt to reproduce.

The background here is that we're running a public hosting service where
customers can install and run their own OSes on their own qemu-kvm virtual
machines. I don't even know what VNC client (if any) was connected at the
time. I only see the core dump if the qemu-kvm crashes.

Of course, if the screen width or height is 1, it doesn't really matter what
the value of the mouse position for the click is, so something as simple as

diff --git a/vnc.c b/vnc.c
--- a/vnc.c
+++ b/vnc.c
@@ -1421,8 +1421,10 @@
         dz = 1;
 
     if (vs->absolute) {
-        kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
-                        y * 0x7FFF / (ds_get_height(vs->ds) - 1),
+        kbd_mouse_event(ds_get_width(vs->ds) > 1 ?
+                          x * 0x7FFF / (ds_get_width(vs->ds) - 1) : 0x4000,
+                        ds_get_height(vs->ds) > 1 ?
+                          y * 0x7FFF / (ds_get_height(vs->ds) - 1) : 0x4000,
                         dz, buttons);
     } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
         x -= 0x7FFF;

will fix the symptom: the division by zero. The underlying cause of a 9x1
display surface is a bit mysterious though.

Cheers,

Chris.

  reply	other threads:[~2010-03-05 16:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-21 17:23 [Qemu-devel] qemu-kvm 0.12.2 VNC segfault Chris Webb
2010-02-22  8:54 ` Avi Kivity
2010-02-22  8:54   ` [Qemu-devel] " Avi Kivity
2010-02-22 19:06   ` Chris Webb
2010-02-22 21:36   ` Anthony Liguori
2010-02-22 21:36     ` [Qemu-devel] " Anthony Liguori
2010-03-01 18:14     ` Another VNC crash, qemu-kvm-0.12.3 Chris Webb
2010-03-01 18:14       ` [Qemu-devel] " Chris Webb
2010-03-03 14:23       ` Anthony Liguori
2010-03-03 14:23         ` [Qemu-devel] " Anthony Liguori
2010-03-05 16:52         ` Chris Webb [this message]
2010-03-05 16:52           ` Chris Webb
2010-03-05 19:57           ` Alexander Graf
2010-03-05 19:57             ` Alexander Graf
2010-03-06  8:53             ` Chris Webb
2010-03-06  8:53               ` Chris Webb
2010-03-08 14:34               ` [PATCH] Fix SIGFPE for vnc display of width/height = 1 Chris Webb
2010-03-08 14:34                 ` [Qemu-devel] " Chris Webb
2010-03-08 18:15                 ` Chris Webb
2010-03-17 15:59                 ` Anthony Liguori
2010-03-17 16:55                   ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100305165209.GL29711@arachsys.com \
    --to=chris@arachsys.com \
    --cc=anthony@codemonkey.ws \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.