qemu-m68k icon indicating copy to clipboard operation
qemu-m68k copied to clipboard

Issues on big-endian hosts

Open glaubitz opened this issue 7 years ago • 3 comments

Hi!

I was recently testing qemu-m68k on a sparc64 machine in the hope to work-around the futex issues we have when running on little-endian hosts (because m68k is big-endian, the futex counter is not passed evaluated properly by the kernel), but to my surprise, qemu-m68k actually crashed:

root@deb4g:~/qemu-m68k# gdb ./m68k-linux-user/qemu-m68k
GNU gdb (Debian 7.11.1-2+b2) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "sparc64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./m68k-linux-user/qemu-m68k...done.
(gdb) run /srv/sid-m68k-sbuild/lib/ld.so.1
Starting program: /root/qemu-m68k/m68k-linux-user/qemu-m68k /srv/sid-m68k-sbuild/lib/ld.so.1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/sparc64-linux-gnu/libthread_db.so.1".
[New Thread 0xfff80001007ff910 (LWP 141817)]

Thread 1 "qemu-m68k" received signal SIGBUS, Bus error.
0x000000006041e738 in static_code_gen_buffer ()
(gdb) bt
#0 0x000000006041e738 in static_code_gen_buffer ()
#1 0x0000000060006038 in cpu_tb_exec (cpu=0x624b9550, itb=0xfff8000100883940) at /root/qemu-m68k/cpu-exec.c:160 #2 0x0000000060006d1c in cpu_loop_exec_tb (cpu=0x624b9550, tb=0xfff8000100883940, last_tb=0x7feffffea38, tb_exit=0x7feffffea #3 0x0000000060006f78 in cpu_exec (cpu=0x624b9550) at /root/qemu-m68k/cpu-exec.c:619 #4 0x00000000600469b4 in cpu_loop (env=0x624c1990) at /root/qemu-m68k/linux-user/main.c:3272 #5 0x0000000060049044 in main (argc=2, argv=0x7fefffff5d8, envp=0x7fefffff5f0) at /root/qemu-m68k/linux-user/main.c:5000 (gdb)

This was tested with the 680x0-master-dev branch. Will also now try the m68k-dev branch, hadn't seen that one before.

Adrian

glaubitz avatar Nov 27 '16 18:11 glaubitz

Same crash in the m68k-dev branch:

root@deb4g:/srv/sid-m68k-sbuild# gdb ~/qemu-m68k/m68k-linux-user/qemu-m68k GNU gdb (Debian 7.11.1-2+b2) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "sparc64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /root/qemu-m68k/m68k-linux-user/qemu-m68k...done. (gdb) run -cpu m68040 /srv/sid-m68k-sbuild/lib/ld.so.1 Starting program: /root/qemu-m68k/m68k-linux-user/qemu-m68k -cpu m68040 /srv/sid-m68k-sbuild/lib/ld.so.1 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/sparc64-linux-gnu/libthread_db.so.1". [New Thread 0xfff80001007ff910 (LWP 75080)]

Thread 1 "qemu-m68k" received signal SIGBUS, Bus error. 0x0000000060453368 in static_code_gen_buffer () (gdb) bt #0 0x0000000060453368 in static_code_gen_buffer () #1 0x000000006000630c in cpu_tb_exec (cpu=0x624f0170, itb=0xfff8000100883940) at /root/qemu-m68k/cpu-exec.c:164 #2 0x0000000060007140 in cpu_loop_exec_tb (cpu=0x624f0170, tb=0xfff8000100883940, last_tb=0x7feffffea48, tb_exit=0x7feffffea44, sc=0x7feffffea60) at /root/qemu-m68k/cpu-exec.c:544 #3 0x0000000060007384 in cpu_exec (cpu=0x624f0170) at /root/qemu-m68k/cpu-exec.c:638 #4 0x0000000060050c80 in cpu_loop (env=0x624f85b0) at /root/qemu-m68k/linux-user/main.c:2835 #5 0x00000000600532d8 in main (argc=4, argv=0x7fefffff5e8, envp=0x7fefffff610) at /root/qemu-m68k/linux-user/main.c:4560 (gdb)

glaubitz avatar Nov 27 '16 22:11 glaubitz

Did you try to run a qemu-ppc on sparc64 to see if it is specific to m68k or to the generic part?

vivier avatar Nov 28 '16 07:11 vivier

Good idea. Just gave it a try, qemu-ppc works fine:

root@deb4g:~/ppc-test/lib/powerpc-linux-gnu# ~/qemu-m68k/ppc-linux-user/qemu-ppc ./ld-2.19.so Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...] You have invoked ld.so', the helper program for shared library executables. This program usually lives in the file /lib/ld.so', and special directives in executable files using ELF shared libraries tell the system's program loader to load the helper program from this file. This helper program loads the shared libraries needed by the program executable, prepares the program to run, and runs it. You may invoke this helper program directly from the command line to load and run an ELF executable file; this is like executing that file itself, but always uses this helper program from the file you specified, instead of the helper program file specified in the executable file you run. This is mostly of use for maintainers to test new versions of this helper program; chances are you did not intend to run this program.

--list list all dependencies and how they are resolved --verify verify that given object really is a dynamically linked object we can handle --inhibit-cache Do not use /etc/ld.so.cache --library-path PATH use given PATH instead of content of the environment variable LD_LIBRARY_PATH --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names in LIST --audit LIST use objects named in LIST as auditors root@deb4g:~/ppc-test/lib/powerpc-linux-gnu#

glaubitz avatar Nov 28 '16 10:11 glaubitz