Skip to contentSkip to conversation

Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Qemu-devel Brad Campbell 4 participants 14 messages May 30, 2008 – May 31, 2008

lore
Share & tools
lore
#0 lore raw

(gdb) run
Starting program: /home/brad/bin/qemu -fda /tmp/fd.img -hda /home/brad/qemu/xptest.img -cdrom /raid3/isos/XP-corp-sp2.iso -localtime -m 256 -usb -usbdevice tablet -std-vga -no-acpi -vnc :2 -boot d -no-reboot -no-kqemu Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread 139849118447312 (LWP 9558)]
[New Thread 1098533216 (LWP 9561)]

Program received signal SIGUSR2, User defined signal 2. [Switching to Thread 139849118447312 (LWP 9558)] temp_save (s=0x3, temp=11050592, allocated_regs=16404)

    at /home/brad/src/qemu/tcg/tcg.c:1334
1334	    ts = &s->temps[temp];
(gdb) bt
#0  temp_save (s=0x3, temp=11050592, allocated_regs=16404)
    at /home/brad/src/qemu/tcg/tcg.c:1334
#1  0x00000000004defc2 in save_globals (s=0xa89e60, allocated_regs=16404)
    at /home/brad/src/qemu/tcg/tcg.c:1368
#2  0x00000000004dfd22 in tcg_reg_alloc_op (s=0xa89e60, def=0x687200, opc=69,
    args=0xa7ecf8, dead_iargs=1) at /home/brad/src/qemu/tcg/tcg.c:1586
#3  0x00000000004ead88 in dyngen_code (s=0xa89e60,
    gen_code_buf=0x431640b0 "1?A\211>1?A\211v\004A\213v H\213?I\211?\230")
    at /home/brad/src/qemu/tcg/tcg.c:1960
#4  0x000000000048ca51 in cpu_x86_gen_code (env=0xb07980, tb=0x7f31139fdfe0,
    gen_code_size_ptr=0x7fff3107c6bc)
    at /home/brad/src/qemu/translate-all.c:121
#5  0x000000000048d1e2 in cpu_x86_exec (env1=0xa89e60)
    at /home/brad/src/qemu/cpu-exec.c:144
#6  0x000000000040f96c in main (argc=21, argv=0x0)
    at /home/brad/src/qemu/vl.c:7076

Does this mean anything to the tcg wizards ?

Regards,
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#1 lore raw
Quoted 11 lines · Brad Campbell

(gdb) run
Starting program: /home/brad/bin/qemu -fda /tmp/fd.img -hda
/home/brad/qemu/xptest.img -cdrom /raid3/isos/XP-corp-sp2.iso -localtime -m 256 -usb -usbdevice tablet -std-vga -no-acpi -vnc :2 -boot d -no-reboot -no-kqemu
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread 139849118447312 (LWP 9558)]
[New Thread 1098533216 (LWP 9561)]

Program received signal SIGUSR2, User defined signal 2.

I'm afraid this is not the backtrace you want. You need to ignore SIGUSR2 and continue until the SIGSEGV:

(gdb) handle SIGUSR2 nostop noprint pass
(gdb) c
(gdb) bt

HTH

Signature · 2 lines
Please do not print this email unless absolutely necessary. Spread
environmental awareness.
#2 lore raw
Quoted 13 lines · andrzej zaborowski
Quoted 11 lines · Brad Campbell

(gdb) run
Starting program: /home/brad/bin/qemu -fda /tmp/fd.img -hda
/home/brad/qemu/xptest.img -cdrom /raid3/isos/XP-corp-sp2.iso -localtime -m 256 -usb -usbdevice tablet -std-vga -no-acpi -vnc :2 -boot d -no-reboot -no-kqemu
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread 139849118447312 (LWP 9558)]
[New Thread 1098533216 (LWP 9561)]

Program received signal SIGUSR2, User defined signal 2.

Quoted 8 lines

I'm afraid this is not the backtrace you want. You need to ignore SIGUSR2 and continue until the SIGSEGV:

(gdb) handle SIGUSR2 nostop noprint pass
(gdb) c
(gdb) bt

HTH

Thanks Paul, that helped greatly!

Program received signal SIGUSR2, User defined signal 2. [Switching to Thread 140040879920848 (LWP 15924)] 0x00007f5dce73cffd in __lll_mutex_unlock_wake () from /lib/libpthread.so.0 (gdb) handle SIGUSR2 nostop noprint pass
Signal Stop Print Pass to program Description
SIGUSR2 No No Yes User defined signal 2
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault. 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000) at vnc.c:536
536 if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
(gdb) bt
#0 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000)

    at vnc.c:536
#1  0x000000000040668c in qemu_run_timers (ptimer_head=0x688cc0,
    current_time=9750412) at /home/brad/src/qemu/vl.c:1077
#2  0x000000000040ca0c in main_loop_wait (timeout=0)
    at /home/brad/src/qemu/vl.c:7043
#3  0x000000000040fa15 in main (argc=21, argv=0x0)
    at /home/brad/src/qemu/vl.c:7133

I'm running this on a headless machine and don't have libSDL installed (compiled with --disable-gfx-check) and I'll lay odds it's something weird here.. I'm getting this with Ubuntu guest also now, so it's easier for me to track down!

Regards,
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#3 lore raw
Quoted 18 lines · Brad Campbell
Quoted 17 lines · andrzej zaborowski
Quoted 11 lines · Brad Campbell

(gdb) run
Starting program: /home/brad/bin/qemu -fda /tmp/fd.img -hda
/home/brad/qemu/xptest.img -cdrom /raid3/isos/XP-corp-sp2.iso -localtime -m
256 -usb -usbdevice tablet -std-vga -no-acpi -vnc :2 -boot d -no-reboot -no-kqemu
Failed to read a valid object file image from memory. [Thread debugging using libthread_db enabled]
[New Thread 139849118447312 (LWP 9558)]
[New Thread 1098533216 (LWP 9561)]

Quoted 1 line

Program received signal SIGUSR2, User defined signal 2.

I'm afraid this is not the backtrace you want. You need to ignore SIGUSR2 and continue until the SIGSEGV:

Quoted 7 lines
Quoted 5 lines

(gdb) handle SIGUSR2 nostop noprint pass
(gdb) c
(gdb) bt

HTH

Thanks Paul, that helped greatly!

My sincerest apologies Andrzej, I'm not sure where my brain was when I wrote that!

Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#4 lore raw

[Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

In reply to Brad Campbell
Quoted 14 lines · Brad Campbell

Program received signal SIGSEGV, Segmentation fault. 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000) at vnc.c:536
536 if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
(gdb) bt
#0 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000)

    at vnc.c:536
#1  0x000000000040668c in qemu_run_timers (ptimer_head=0x688cc0,
    current_time=9750412) at /home/brad/src/qemu/vl.c:1077
#2  0x000000000040ca0c in main_loop_wait (timeout=0)
    at /home/brad/src/qemu/vl.c:7043
#3  0x000000000040fa15 in main (argc=21, argv=0x0)
    at /home/brad/src/qemu/vl.c:7133
Quoted 2 lines

I'm running this on a headless machine and don't have libSDL installed (compiled with --disable-gfx-check) and I'll lay odds it's something weird here.. I'm getting this with Ubuntu guest also now, so it's easier for me to track down!

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#5 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Quoted 15 lines · Brad Campbell
Quoted 14 lines · Brad Campbell

Program received signal SIGSEGV, Segmentation fault. 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000) at vnc.c:536
536 if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
(gdb) bt
#0 0x000000000046d5a5 in vnc_update_client (opaque=0x7f5db8e99000)

    at vnc.c:536
#1  0x000000000040668c in qemu_run_timers (ptimer_head=0x688cc0,
    current_time=9750412) at /home/brad/src/qemu/vl.c:1077
#2  0x000000000040ca0c in main_loop_wait (timeout=0)
    at /home/brad/src/qemu/vl.c:7043
#3  0x000000000040fa15 in main (argc=21, argv=0x0)
    at /home/brad/src/qemu/vl.c:7133
Quoted 5 lines
Quoted 2 lines

I'm running this on a headless machine and don't have libSDL installed (compiled with --disable-gfx-check) and I'll lay odds it's something weird here.. I'm getting this with Ubuntu guest also now, so it's easier for me to track down!

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Regards

Anthony Liguori

Quoted 1 line

Brad

#6 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Quoted 4 lines · Anthony Liguori
Quoted 2 lines

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Yep

brad@srv-64:~/src/qemu$ svn up
At revision 4622.

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

Regards,
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#7 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Quoted 11 lines · Brad Campbell
Quoted 3 lines · Anthony Liguori
Quoted 1 line

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Yep

brad@srv-64:~/src/qemu$ svn up
At revision 4622.

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

How are you reproducing it? With what client?

Regards,

Anthony Liguori

Quoted 2 lines

Regards,
Brad

#8 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

2008/5/30 Anthony Liguori <[email protected]>:

Quoted 16 lines
Quoted 14 lines · Brad Campbell

Anthony Liguori wrote:

Ok, this is a general VNC explosion. If I compile it with libSDL and run

Quoted 6 lines
Quoted 3 lines

a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Yep

brad@srv-64:~/src/qemu$ svn up
At revision 4622.
Quoted 7 lines
Quoted 3 lines

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

How are you reproducing it? With what client?

This seems related to a problem discussed here some time ago:

http://lists.gnu.org/archive/html/qemu-devel/2007-10/msg00104.html

If it is so, to reproduce it just use a client without DesktopSize pseudoencoding and tell the guest OS to scale down his window. A segfault will follow in the next SetPixelFormat received by qemu.

Regards,
Edu

P.S. (I don't know if my original patch already applies)

#9 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Quoted 25 lines · Eduardo Felipe

2008/5/30 Anthony Liguori <[email protected] <mailto:[email protected]>>:

Brad Campbell wrote:

Anthony Liguori wrote:

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Yep
brad@srv-64:~/src/qemu$ svn up
At revision 4622.

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

Quoted 8 lines

How are you reproducing it? With what client?

This seems related to a problem discussed here some time ago:

http://lists.gnu.org/archive/html/qemu-devel/2007-10/msg00104.html

If it is so, to reproduce it just use a client without DesktopSize pseudoencoding and tell the guest OS to scale down his window. A segfault will follow in the next SetPixelFormat received by qemu.

That shoudl be fixed in SVN.

Regards,

Anthony Liguori

Quoted 4 lines

Regards,
Edu

P.S. (I don't know if my original patch already applies)

#12 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Brad Campbell
Quoted 3 lines · Anthony Liguori
Quoted 1 line

Ok, this is a general VNC explosion. If I compile it with libSDL and run a standard SDL window over X then it works fine. As soon as I add -vnc :2 to the command line it blows up in the same place.

Is this the latest SVN? There was a recent SEGV fix for VNC.

Quoted 7 lines
Quoted 5 lines

Yep

brad@srv-64:~/src/qemu$ svn up
At revision 4622.

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

How are you reproducing it? With what client?

Great question. I tried the realvnc based xvncviewer and the problem did not occur.

brad@bklaptop2:~$ xvnc4viewer --version

VNC Viewer Free Edition 4.1.1 for X - built Apr 16 2008 13:02:40 Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

This one dies horribly. Apparently on resolution change, but not certainly.. It does always die on a screen mode change though.

brad@bklaptop2:~$ vncviewer --version
TightVNC viewer version 1.2.9
Ubuntu package : xtightvncviewer from 8.04

I'm just building the latest tightvnc from source to see if the issue is fixed there, but xtightvncviewer from Ubuntu 8.04 will certainly kill it.

Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#13 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

In reply to Anthony Liguori
Quoted 8 lines · Anthony Liguori
Quoted 5 lines

Yep

brad@srv-64:~/src/qemu$ svn up
At revision 4622.

It's very easily reproducible here, I'll have some time tomorrow to look at it closer and see if I can fix it.

How are you reproducing it? With what client?

Ok, this is compiled from source and still kills it dead.
http://downloads.sourceforge.net/vnc-tight/tightvnc-1.3.9_unixsrc.tar.bz2

brad@bklaptop2:~/temp/vnc_unixsrc/vncviewer$ ./vncviewer --version
TightVNC Viewer version 1.3.9

Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#10 lore raw

Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

In reply to Eduardo Felipe
Quoted 1 line · Eduardo Felipe

This seems related to a problem discussed here some time ago:

Yep!

Quoted 8 lines

http://lists.gnu.org/archive/html/qemu-devel/2007-10/msg00104.html

If it is so, to reproduce it just use a client without DesktopSize pseudoencoding and tell the guest OS to scale down his window. A segfault will follow in the next SetPixelFormat received by qemu.

Regards,
Edu

P.S. (I don't know if my original patch already applies)

It was already sorta integrated by the looks of it.. but not completely.

Patch attached.

Thanks all!
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
vnc.c +8 -6
Index: vnc.c
===================================================================
@@ -307,12 +307,14 @@
     ds->width = w;
     ds->height = h;
     ds->linesize = w * vs->depth;
-    if (vs->csock != -1 && vs->has_resize && size_changed) {
-	vnc_write_u8(vs, 0);  /* msg id */
-	vnc_write_u8(vs, 0);
-	vnc_write_u16(vs, 1); /* number of rects */
-	vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);
-	vnc_flush(vs);
+    if (size_changed) {
+        if (vs->csock != -1 && vs->has_resize && size_changed) {
+	    vnc_write_u8(vs, 0);  /* msg id */
+	    vnc_write_u8(vs, 0);
+	    vnc_write_u16(vs, 1); /* number of rects */
+	    vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);
+	    vnc_flush(vs);
+	}
 	vs->width = ds->width;
 	vs->height = ds->height;
     }
#11 lore raw

[PATCH] Re: [Qemu-devel] VNC Segfault : was Re: Segfault installing Windows XP 32 Bit guest on Linux 64Bit host

Quoted 2 lines · Brad Campbell

Patch attached.

*fixed* patch attached.. <sigh>

Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
vnc.c +8 -6
Index: vnc.c
===================================================================
@@ -307,12 +307,14 @@
     ds->width = w;
     ds->height = h;
     ds->linesize = w * vs->depth;
-    if (vs->csock != -1 && vs->has_resize && size_changed) {
-	vnc_write_u8(vs, 0);  /* msg id */
-	vnc_write_u8(vs, 0);
-	vnc_write_u16(vs, 1); /* number of rects */
-	vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);
-	vnc_flush(vs);
+    if (size_changed) {
+        if (vs->csock != -1 && vs->has_resize) {
+	    vnc_write_u8(vs, 0);  /* msg id */
+	    vnc_write_u8(vs, 0);
+	    vnc_write_u16(vs, 1); /* number of rects */
+	    vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);
+	    vnc_flush(vs);
+	}
 	vs->width = ds->width;
 	vs->height = ds->height;
     }