All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
@ 2017-01-16 21:56 Aníbal Limón
  2017-01-16 22:03 ` Aníbal Limón
  0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2017-01-16 21:56 UTC (permalink / raw)
  To: qemu-ppc; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-01-16 21:56 [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults Aníbal Limón
@ 2017-01-16 22:03 ` Aníbal Limón
  2017-01-30 23:52   ` Sam Bobroff
  0 siblings, 1 reply; 8+ messages in thread
From: Aníbal Limón @ 2017-01-16 22:03 UTC (permalink / raw)
  To: qemu-ppc; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2997 bytes --]



On 01/16/2017 03:56 PM, Aníbal Limón wrote:
> 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

Here is the core dump,

https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing

> 
> Any help will be appreciated.
> 
> Best regards,
> 	alimon
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-01-16 22:03 ` Aníbal Limón
@ 2017-01-30 23:52   ` Sam Bobroff
  2017-01-31 21:49     ` Aníbal Limón
  2017-02-01 15:25     ` Peter Maydell
  0 siblings, 2 replies; 8+ messages in thread
From: Sam Bobroff @ 2017-01-30 23:52 UTC (permalink / raw)
  To: Aníbal Limón; +Cc: qemu-ppc, qemu-devel

On Mon, Jan 16, 2017 at 04:03:21PM -0600, Aníbal Limón wrote:
> 
> 
> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
> > 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.

> > /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
> 
> Here is the core dump,
> 
> https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing
> 
> > 
> > Any help will be appreciated.
> > 
> > Best regards,
> > 	alimon
> > 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-01-30 23:52   ` Sam Bobroff
@ 2017-01-31 21:49     ` Aníbal Limón
  2017-02-01 15:25     ` Peter Maydell
  1 sibling, 0 replies; 8+ messages in thread
From: Aníbal Limón @ 2017-01-31 21:49 UTC (permalink / raw)
  To: Sam Bobroff; +Cc: qemu-ppc, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3522 bytes --]



On 01/30/2017 05:52 PM, Sam Bobroff wrote:
> On Mon, Jan 16, 2017 at 04:03:21PM -0600, Aníbal Limón wrote:
>>
>>
>> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
>>> 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

The patch works, thanks for made it.

Cheers,
	alimon

> 
> Cheers,
> Sam.
> 
>>> /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
>>
>> Here is the core dump,
>>
>> https://drive.google.com/file/d/0B9uDfO-FJ1kgY3ZhendISTZzOUU/view?usp=sharing
>>
>>>
>>> Any help will be appreciated.
>>>
>>> Best regards,
>>> 	alimon
>>>
>>
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-01-30 23:52   ` Sam Bobroff
  2017-01-31 21:49     ` Aníbal Limón
@ 2017-02-01 15:25     ` Peter Maydell
  2017-02-01 22:30       ` David Gibson
  2017-02-01 23:48       ` [Qemu-devel] " Sam Bobroff
  1 sibling, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2017-02-01 15:25 UTC (permalink / raw)
  To: Sam Bobroff
  Cc: Aníbal Limón, qemu-ppc, QEMU Developers, David Gibson

On 30 January 2017 at 23:52, Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
>> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
>> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-02-01 15:25     ` Peter Maydell
@ 2017-02-01 22:30       ` David Gibson
  2017-02-01 23:42         ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
  2017-02-01 23:48       ` [Qemu-devel] " Sam Bobroff
  1 sibling, 1 reply; 8+ messages in thread
From: David Gibson @ 2017-02-01 22:30 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Sam Bobroff, Aníbal Limón, qemu-ppc, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]

On Wed, Feb 01, 2017 at 03:25:05PM +0000, Peter Maydell wrote:
> On 30 January 2017 at 23:52, Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
> >> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
> >> > 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?

Ok, dropped, pending discussion of what the right fix is.

> (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
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc]  qemu-pcc 2.8.0 linux-user segfaults
  2017-02-01 22:30       ` David Gibson
@ 2017-02-01 23:42         ` Laurent Vivier
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2017-02-01 23:42 UTC (permalink / raw)
  To: David Gibson, Peter Maydell
  Cc: qemu-ppc, Aníbal Limón, Sam Bobroff, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 2403 bytes --]

Le 01/02/2017 à 23:30, David Gibson a écrit :
> On Wed, Feb 01, 2017 at 03:25:05PM +0000, Peter Maydell wrote:
>> On 30 January 2017 at 23:52, Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
>>>> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
>>>>> 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).

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 the
POWERPC_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





[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults
  2017-02-01 15:25     ` Peter Maydell
  2017-02-01 22:30       ` David Gibson
@ 2017-02-01 23:48       ` Sam Bobroff
  1 sibling, 0 replies; 8+ messages in thread
From: Sam Bobroff @ 2017-02-01 23:48 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Aníbal Limón, qemu-ppc, QEMU Developers, David Gibson

On Wed, Feb 01, 2017 at 03:25:05PM +0000, Peter Maydell wrote:
> On 30 January 2017 at 23:52, Sam Bobroff <sam.bobroff@au1.ibm.com> wrote:
> >> On 01/16/2017 03:56 PM, Aníbal Limón wrote:
> >> > 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.

Oh, sorry I think I forgot to cross post it!

Thanks for taking a look at it :-)

> 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).

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).

> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-02-01 23:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 21:56 [Qemu-devel] qemu-pcc 2.8.0 linux-user segfaults Aníbal Limón
2017-01-16 22:03 ` Aníbal Limón
2017-01-30 23:52   ` Sam Bobroff
2017-01-31 21:49     ` Aníbal Limón
2017-02-01 15:25     ` Peter Maydell
2017-02-01 22:30       ` David Gibson
2017-02-01 23:42         ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-02-01 23:48       ` [Qemu-devel] " Sam Bobroff

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.