vivier / qemu-m68k

Other
41 stars 7 forks source link

gedit crashes with 'qemu:handle_cpu_signal received signal outside vCPU context' #33

Closed glaubitz closed 6 years ago

glaubitz commented 6 years ago

On qemu-user, gedit crashes with an error message which indicates a problem with multi-threading:

(sid-m68k-sbuild)root@epyc:~# gedit
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x60040339
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x601bff46
(sid-m68k-sbuild)root@epyc:~#

On qemu-system, the crash doesn't show and gedit just complains about a missing display:

root@pacman:~# gedit
[   46.040000] random: crng init done
[   46.040000] random: 7 urandom warning(s) missed due to ratelimiting
Unable to init server: Could not connect: Connection refused

(gedit:611): Gtk-WARNING **: 14:19:02.914: cannot open display: 
root@pacman:~#

To reproduce, just install the gedit package and try to run gedit.

FWIW, the problem exists on qemu-sh4 as well. Didn't test with other architectures yet.

vivier commented 6 years ago

I'm not able to install gedit: ... The following packages have unmet dependencies: gedit : Depends: gedit-common (< 3.23) but 3.28.1-1 is to be installed Recommends: zenity but it is not going to be installed Recommends: yelp but it is not going to be installed

# cat /etc/apt/sources.list deb http://ftp.de.debian.org/debian-ports/ sid main

glaubitz commented 6 years ago

That happens before the FTP are synced. gedit was just uploaded earlier today after I built it manually on qemu-system.

You need to use this sources.list which includes the incoming servers:

# binary default
deb http://ftp.ports.debian.org/debian-ports/ unstable main
deb http://incoming.ports.debian.org/buildd/ unstable main
deb http://ftp.ports.debian.org/debian-ports/ unreleased main

# source
deb-src http://ftp.debian.org/debian/ unstable main
deb-src http://incoming.debian.org/debian-buildd/ buildd-unstable main
vivier commented 6 years ago

This should fix the problem:

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index dfc851cc35..b0778fc07c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3892,7 +3892,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
             len = ret;
             if (fd_trans_host_to_target_data(fd)) {
                 ret = fd_trans_host_to_target_data(fd)(msg.msg_iov->iov_base,
-                                                       len);
+                                                       msg.msg_iov->iov_len);
             } else {
                 ret = host_to_target_cmsg(msgp, &msg);
             }
glaubitz commented 6 years ago

Yes, I can confirm that both this patch as well as the second one you just posted to qemu-devel fixes the problem.

However, I'm getting a couple of error messages/warnings which I don't see on qemu-user:

(sid-m68k-sbuild)root@nofan:/# gedit
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20
Unknown host RTA type: 12
Unknown host RTA type: 20

(gedit:26088): Gtk-WARNING **: 22:04:54.119: Locale not supported by C library.
        Using the fallback 'C' locale.
Unable to init server: Could not connect: Connection refused

(gedit:26088): Gtk-WARNING **: 22:04:54.137: cannot open display: 
(sid-m68k-sbuild)root@nofan:/#
vivier commented 6 years ago

You can find fixes in my branch linux-user-gedit:

ea76986eaf linux-user: update netlink 1cad517ebd linux-user: fix recvmsg()/recvfrom() with netlink and MSG_TRUNC

glaubitz commented 6 years ago

Has it been merged upstream yet?

vivier commented 6 years ago

Not yet. we are in Hard feature freeze (3.0.0-rc4), as these are not regression I'll merge them after the release of 3.0.

glaubitz commented 6 years ago

Closing as this has been fixed upstream: https://git.qemu.org/?p=qemu.git;a=commit;h=2a03d3e6ae1b1ca86199a0c36a35e8ac847905f6