qemu-pcc 2.8.0 linux-user segfaults
Hi folks,
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/build/ppc-linux-user/qemu-ppc
-s 16M -r 3.2.0 -cpu 7400 -L/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc -E LD_LIBRARY_PATH=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/.libs:.libs:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//usr/lib:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//lib /home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/Gio-2.0 --introspect-dump=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/functions.txt,/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/dump.xml [Thread debugging using libthread_db enabled]
And the debug info,
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff7fd0780 (LWP 25457) "qemu-ppc"
pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
2 Thread 0x7ffff647e700 (LWP 25461) "qemu-ppc" syscall () at../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
* 3 Thread 0x7ffff7f4d700 (LWP 25462) "qemu-ppc" 0x000000000086fba4
in static_code_gen_buffer ()
(gdb) bt
#0 0x000000000086fba4 in static_code_gen_buffer ()
#1 0x000000000040e922 in cpu_tb_exec (itb=<optimized out>,
itb=<optimized out>, cpu=0x29864d0) at /home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:164 #2 cpu_loop_exec_tb (sc=<optimized out>, tb_exit=<synthetic pointer>,
last_tb=<synthetic pointer>, tb=<optimized out>, cpu=0x29864d0) at /home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:544 #3 cpu_exec (cpu=cpu@entry=0x29864d0) at /home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:638 #4 0x0000000000445fba in cpu_loop (env=env@entry=0x298e750) at /home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/main.c:1359 #5 0x0000000000448a95 in clone_func (arg=0x7fffffffa910) at /home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/syscall.c:6090 #6 0x00007ffff6a750a4 in start_thread (arg=0x7ffff7f4d700) at
pthread_create.c:309
#7 0x00007ffff67aa62d in clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111
Any help will be appreciated.
Best regards,
alimon
Quoted 36 lines · Aníbal Limón
Hi folks,
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/build/ppc-linux-user/qemu-ppc
-s 16M -r 3.2.0 -cpu 7400 -L/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc-E LD_LIBRARY_PATH=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/.libs:.libs:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//usr/lib:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//lib/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/Gio-2.0--introspect-dump=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/functions.txt,/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/dump.xml [Thread debugging usinglibthread_dbenabled]And the debug info,
(gdb) info threads
Id Target Id Frame
1 Thread0x7ffff7fd0780(LWP 25457) "qemu-ppc"
pthread_cond_wait@@GLIBC_2.3.2 () at../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
2 Thread0x7ffff647e700(LWP 25461) "qemu-ppc" syscall () at../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
* 3 Thread0x7ffff7f4d700(LWP 25462) "qemu-ppc"0x000000000086fba4
instatic_code_gen_buffer()(gdb) bt
#00x000000000086fba4instatic_code_gen_buffer()
#10x000000000040e922incpu_tb_exec(itb=<optimized out>,
itb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:164#2cpu_loop_exec_tb(sc=<optimized out>, tb_exit=<synthetic pointer>, last_tb=<synthetic pointer>, tb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:544#3cpu_exec(cpu=cpu@entry=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:638
Quoted 8 lines
#4
0x0000000000445fbaincpu_loop(env=env@entry=0x298e750) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/main.c:1359#50x0000000000448a95inclone_func(arg=0x7fffffffa910) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/syscall.c:6090#60x00007ffff6a750a4instart_thread(arg=0x7ffff7f4d700) at
pthread_create.c:309
#70x00007ffff67aa62din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111
Here is the core dump,
https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing
Quoted 6 lines
Any help will be appreciated.
Best regards,
alimon
Quoted 7 lines · Aníbal Limón
Quoted 4 lines · Aníbal Limón
Hi folks,
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
Hi Aníbal,
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
Cheers,
Sam.
Quoted 51 lines
Quoted 31 lines
/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/build/ppc-linux-user/qemu-ppc
-s 16M -r 3.2.0 -cpu 7400 -L/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc-E LD_LIBRARY_PATH=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/.libs:.libs:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//usr/lib:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//lib/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/Gio-2.0--introspect-dump=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/functions.txt,/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/dump.xml [Thread debugging usinglibthread_dbenabled]And the debug info,
(gdb) info threads
Id Target Id Frame
1 Thread0x7ffff7fd0780(LWP 25457) "qemu-ppc"
pthread_cond_wait@@GLIBC_2.3.2 () at../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
2 Thread0x7ffff647e700(LWP 25461) "qemu-ppc" syscall () at../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
* 3 Thread0x7ffff7f4d700(LWP 25462) "qemu-ppc"0x000000000086fba4
instatic_code_gen_buffer()(gdb) bt
#00x000000000086fba4instatic_code_gen_buffer()
#10x000000000040e922incpu_tb_exec(itb=<optimized out>,
itb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:164#2cpu_loop_exec_tb(sc=<optimized out>, tb_exit=<synthetic pointer>, last_tb=<synthetic pointer>, tb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:544#3cpu_exec(cpu=cpu@entry=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:638Quoted 8 lines
#4
0x0000000000445fbaincpu_loop(env=env@entry=0x298e750) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/main.c:1359#50x0000000000448a95inclone_func(arg=0x7fffffffa910) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/syscall.c:6090#60x00007ffff6a750a4instart_thread(arg=0x7ffff7f4d700) at
pthread_create.c:309
#70x00007ffff67aa62din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111Here is the core dump,
https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing
Quoted 6 lines
Any help will be appreciated.
Best regards,
alimon
Quoted 9 lines · Sam Bobroff
Quoted 7 lines · Aníbal Limón
Quoted 4 lines · Aníbal Limón
Hi folks,
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
Quoted 6 lines
Hi Aníbal,
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
The patch works, thanks for made it.
Cheers,
alimon
Quoted 58 lines
Cheers,
Sam.Quoted 51 lines
Quoted 31 lines
/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/build/ppc-linux-user/qemu-ppc
-s 16M -r 3.2.0 -cpu 7400 -L/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc-E LD_LIBRARY_PATH=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/.libs:.libs:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//usr/lib:/home/alimon/repos/poky/build-ppc/tmp/sysroots/qemuppc//lib/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/Gio-2.0--introspect-dump=/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/functions.txt,/home/alimon/repos/poky/build-ppc/tmp/work/ppc7400-poky-linux/gobject-introspection/1.50.0-r0/build/tmp-introspectu_ewt_1z/dump.xml [Thread debugging usinglibthread_dbenabled]And the debug info,
(gdb) info threads
Id Target Id Frame
1 Thread0x7ffff7fd0780(LWP 25457) "qemu-ppc"
pthread_cond_wait@@GLIBC_2.3.2 () at../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
2 Thread0x7ffff647e700(LWP 25461) "qemu-ppc" syscall () at../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
* 3 Thread0x7ffff7f4d700(LWP 25462) "qemu-ppc"0x000000000086fba4
instatic_code_gen_buffer()(gdb) bt
#00x000000000086fba4instatic_code_gen_buffer()
#10x000000000040e922incpu_tb_exec(itb=<optimized out>,
itb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:164#2cpu_loop_exec_tb(sc=<optimized out>, tb_exit=<synthetic pointer>, last_tb=<synthetic pointer>, tb=<optimized out>, cpu=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:544#3cpu_exec(cpu=cpu@entry=0x29864d0) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/cpu-exec.c:638Quoted 8 lines
#4
0x0000000000445fbaincpu_loop(env=env@entry=0x298e750) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/main.c:1359#50x0000000000448a95inclone_func(arg=0x7fffffffa910) at/home/alimon/repos/poky/build-ppc/tmp/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/syscall.c:6090#60x00007ffff6a750a4instart_thread(arg=0x7ffff7f4d700) at
pthread_create.c:309
#70x00007ffff67aa62din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111Here is the core dump,
https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing
Quoted 6 lines
Any help will be appreciated.
Best regards,
alimon
Quoted 8 lines · Sam Bobroff
Quoted 3 lines · Aníbal Limón
Quoted 2 lines
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
Hmm, I missed that patch (it doesn't seem to have made it to the qemu-devel list), but it isn't correct, I'm afraid. In the patch for handling TARGET_USER_ESIGRETURN you must not change the nip register, because we will have just set it from the signal context that the guest provided to the sigreturn syscall. (The patch as it stands will cause us to reexecute an instruction after return from a signal handler, which isn't going to go very well).
David, can you drop that patch from your ppc queue, please?
(I think the change is good otherwise but I couldn't seem to find the bit in the ppc linux kernel that corresponds to moving the NIP value around.)
thanks
-- PMM
Quoted 19 lines · Peter Maydell
Quoted 8 lines · Sam Bobroff
Quoted 3 lines · Aníbal Limón
Quoted 2 lines
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
Hmm, I missed that patch (it doesn't seem to have made it to the qemu-devel list), but it isn't correct, I'm afraid. In the patch for handling
TARGET_USER_ESIGRETURNyou must not change the nip register, because we will have just set it from the signal context that the guest provided to the sigreturn syscall. (The patch as it stands will cause us to reexecute an instruction after return from a signal handler, which isn't going to go very well).
Quoted 1 line
David, can you drop that patch from your ppc queue, please?
Ok, dropped, pending discussion of what the right fix is.
Quoted 7 lines
(I think the change is good otherwise but I couldn't seem to find the bit in the ppc linux kernel that corresponds to moving the NIP value around.)
thanks
-- PMM
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 11 lines · David Gibson
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Sam Bobroff
Quoted 3 lines · Aníbal Limón
Quoted 2 lines
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
Quoted 8 lines
Quoted 8 lines
Hmm, I missed that patch (it doesn't seem to have made it to the qemu-devel list), but it isn't correct, I'm afraid. In the patch for handling
TARGET_USER_ESIGRETURNyou must not change the nip register, because we will have just set it from the signal context that the guest provided to the sigreturn syscall. (The patch as it stands will cause us to reexecute an instruction after return from a signal handler, which isn't going to go very well).
I think commit bd6fefe has already made the change in target-ppc/excp_helper.c:
case POWERPC_EXCP_SYSCALL: /* System call exception
*/
dump_syscall(env);
lev = env->error_code;+ /* We need to correct the NIP which in this case is supposed
+ * to point to the next instruction
+ */
+ env->nip += 4;
+
/* "PAPR mode" built-in hypercall emulation */
if ((lev == 1) && cpu_ppc_hypercall) {
cpu_ppc_hypercall(cpu);And target/ppc/translate.c:
#if defined(CONFIG_USER_ONLY)
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL_USER
#else
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL
#endif
So I guess the fix should be only to revert thePOWERPC_EXCP_SYSCALL_USER change of bd6fefe with:
@@ -2001,9 +2001,9 @@ void cpu_loop(CPUPPCState *env)
env->gpr[5], env->gpr[6], env->gpr[7],
env->gpr[8], 0, 0);
if (ret == -TARGET_ERESTARTSYS) {
+ env->nip -= 4;
break;
}
- env->nip += 4;
if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) {
/* Returning from a successful sigreturn syscall.
Avoid corrupting register state. */Not sure anyway...
Laurent
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Sam Bobroff
Quoted 3 lines · Aníbal Limón
Quoted 2 lines
I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults in qemu-ppc when is executing:
Quoted 7 lines
Quoted 4 lines
I've recently encountered a similar problem and I've posted a fix. If you'd like to try it, it's here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html
Hmm, I missed that patch (it doesn't seem to have made it to the qemu-devel list), but it isn't correct, I'm afraid.
Oh, sorry I think I forgot to cross post it!
Thanks for taking a look at it :-)
Quoted 6 lines
In the patch for handling
TARGET_USER_ESIGRETURNyou must not change the nip register, because we will have just set it from the signal context that the guest provided to the sigreturn syscall. (The patch as it stands will cause us to reexecute an instruction after return from a signal handler, which isn't going to go very well).
Ah, thank you. I think I understand what you mean: do_syscall() and the TARGET_QEMU_ESIGRETURN case must both see the same value for env->nip().
I tried a test program that went through that case (which I obviously should have done before) and you're definitely right, because userspace gets stuck looping on the system call. Removing the NIP adjustment from the case seems to fix it. Is that what you mean? (I'll post a v2 with that change if so.)
It seems that the similar adjustment for the TARGET_ERESTARTSYS should stay, as removing it causes signal restart to fail (userspace sees -EINTR even when they've specified a signal handler with SA_RESTART).
Quoted 8 lines
David, can you drop that patch from your ppc queue, please?
(I think the change is good otherwise but I couldn't seem to find the bit in the ppc linux kernel that corresponds to moving the NIP value around.)
thanks
-- PMM
Thanks again for the help!
Sam.