Re: [Qemu-devel] Crash when running hello-world unikernel for ARM

2018-04-09 Thread Ajay Garg
Following is the gdb details :

##
ajay@debian:~/rumprun-arm32$ gdb --args qemu-system-arm -machine virt
-nographic -kernel helloer.bin
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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 "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from qemu-system-arm...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/qemu-system-arm -machine virt -nographic
-kernel helloer.bin
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb388f290 (LWP 3140)]
qemu: fatal: Trying to execute code outside RAM or ROM at 0x0010

R00= R01= R02= R03=
R04=
Program received signal SIGUSR1, User defined signal 1.
[Switching to Thread 0xb388f290 (LWP 3140)]
0xb5e80f42 in write () at ../sysdeps/unix/syscall-template.S:81
81../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0xb5e80f42 in write () at ../sysdeps/unix/syscall-template.S:81
#1  0xb5e45c84 in _IO_new_file_write (f=0xb5ee29f0 <_IO_2_1_stderr_>,
data=0xb388c5a0, n=12) at fileops.c:1253
#2  0xb5e454b2 in new_do_write (fp=fp@entry=0xb5ee29f0 <_IO_2_1_stderr_>,
data=data@entry=0xb388c5a0 "R04=", to_do=to_do@entry=12)
at fileops.c:530
#3  0xb5e460d0 in _IO_new_file_xsputn (f=0xb5ee29f0 <_IO_2_1_stderr_>,
data=, n=12) at fileops.c:1335
#4  0xb5e2bc8e in buffered_vfprintf (s=s@entry=0xb5ee29f0 <_IO_2_1_stderr_>,
format=format@entry=0x263e68 "R%02d=%08x", args=...) at vfprintf.c:2369
#5  0xb5e28418 in _IO_vfprintf_internal (s=0xb5ee29f0 <_IO_2_1_stderr_>,
format=0x263e68 "R%02d=%08x", format@entry=0x84ad60 "pg\201", ap=...,
ap@entry=...) at vfprintf.c:1296
#6  0xb5e2ee00 in __fprintf (stream=,
format=0x263e68 "R%02d=%08x") at fprintf.c:32
#7  0x000dc352 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
#0  0xb5e80f42 in write () at ../sysdeps/unix/syscall-template.S:81
#1  0xb5e45c84 in _IO_new_file_write (f=0xb5ee29f0 <_IO_2_1_stderr_>,
data=0xb388c5a0, n=12) at fileops.c:1253
#2  0xb5e454b2 in new_do_write (fp=fp@entry=0xb5ee29f0 <_IO_2_1_stderr_>,
data=data@entry=0xb388c5a0 "R04=", to_do=to_do@entry=12)
at fileops.c:530
#3  0xb5e460d0 in _IO_new_file_xsputn (f=0xb5ee29f0 <_IO_2_1_stderr_>,
data=, n=12) at fileops.c:1335
#4  0xb5e2bc8e in buffered_vfprintf (s=s@entry=0xb5ee29f0 <_IO_2_1_stderr_>,
format=format@entry=0x263e68 "R%02d=%08x", args=...) at vfprintf.c:2369
#5  0xb5e28418 in _IO_vfprintf_internal (s=0xb5ee29f0 <_IO_2_1_stderr_>,
format=0x263e68 "R%02d=%08x", format@entry=0x84ad60 "pg\201", ap=...,
ap@entry=...) at vfprintf.c:1296
#6  0xb5e2ee00 in __fprintf (stream=,
format=0x263e68 "R%02d=%08x") at fprintf.c:32
#7  0x000dc352 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
##

On Tue, Apr 10, 2018 at 9:44 AM, Ajay Garg  wrote:
> Thanks Alex for the reply ..
>
>>
>> Can you run under -s -S and gdb step the *guest* and see where it ends
>> up. The above error is usually indicative of the guest going off into
>> the weeds somewhere because the hardware isn't what it expects.
>>
>
> So, after your reply that it might be because of the
> hardware-mismatch, I kinda took a detour, and installed a arm32 "virt"
> machine on qemu on a x86_64 host, as per the steps at
> https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
>
> All went fine, and then I compiled rumprun on this "virt" guest.
> Finally, upon running, I now get this :
>
> ##
> ajay@debian:~/rumprun-arm32$ qemu-system-arm -machine virt -nographic
> -kernel helloer.bin
> qemu: fatal: Trying to execute code outside RAM or ROM at 0x0010
>
> R00= R01= R02= R03=
> R04= R05= R06= R07=
> R08= R09= R10= R11=
> R12= R13= R14= R15=0010
> PSR=41d3 -Z-- A svc32
> s00= s01= d00=
> 

Re: [Qemu-devel] Crash when running hello-world unikernel for ARM

2018-04-09 Thread Ajay Garg
Thanks Alex for the reply ..

>
> Can you run under -s -S and gdb step the *guest* and see where it ends
> up. The above error is usually indicative of the guest going off into
> the weeds somewhere because the hardware isn't what it expects.
>

So, after your reply that it might be because of the
hardware-mismatch, I kinda took a detour, and installed a arm32 "virt"
machine on qemu on a x86_64 host, as per the steps at
https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/

All went fine, and then I compiled rumprun on this "virt" guest.
Finally, upon running, I now get this :

##
ajay@debian:~/rumprun-arm32$ qemu-system-arm -machine virt -nographic
-kernel helloer.bin
qemu: fatal: Trying to execute code outside RAM or ROM at 0x0010

R00= R01= R02= R03=
R04= R05= R06= R07=
R08= R09= R10= R11=
R12= R13= R14= R15=0010
PSR=41d3 -Z-- A svc32
s00= s01= d00=
s02= s03= d01=
s04= s05= d02=
s06= s07= d03=
s08= s09= d04=
s10= s11= d05=
s12= s13= d06=
s14= s15= d07=
s16= s17= d08=
s18= s19= d09=
s20= s21= d10=
s22= s23= d11=
s24= s25= d12=
s26= s27= d13=
s28= s29= d14=
s30= s31= d15=
s32= s33= d16=
s34= s35= d17=
s36= s37= d18=
s38= s39= d19=
s40= s41= d20=
s42= s43= d21=
s44= s45= d22=
s46= s47= d23=
s48= s49= d24=
s50= s51= d25=
s52= s53= d26=
s54= s55= d27=
s56= s57= d28=
s58= s59= d29=
s60= s61= d30=
s62= s63= d31=
FPSCR: 
Aborted
##


Additionally, I compiled rumprun on a beaglebone-green-wireless (arm32
machine), and did the same test.
(Fortunately), I got the exact same stacktrace as above, so I guess
it's no more  an issue with hardware-mismatch now ..

Not sure if this is an issue with qemu now, or rumprun ...


Thanks and Regards,
Ajay



Re: [Qemu-devel] Crash when running hello-world unikernel for ARM

2018-04-09 Thread Alex Bennée

Ajay Garg  writes:

>>
>> qemu-system-x86_64 is expecting an x86 binary blob. I assume you need
>> qemu-system-arm. More importantly you need to specify a -M machine type
>> that matches whatever rumprun is expecting.
>>
>
> Oops, sorry my bad.
> Here is the updated status :
>
> ajay@latitude-3480:~/rumprun-arm-hw/rumprun$ qemu-system-arm -machine
> virt -nographic -nographic -kernel helloer.bin
> Bad ram pointer 0x1e8
> Aborted (core dumped)

Can you run under -s -S and gdb step the *guest* and see where it ends
up. The above error is usually indicative of the guest going off into
the weeds somewhere because the hardware isn't what it expects.

>
>
> ajay@latitude-3480:~/rumprun-arm-hw/rumprun$ gdb --args
> qemu-system-arm -machine virt -nographic -nographic -kernel
> helloer.bin
> GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
> Copyright (C) 2016 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> 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 "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> .
> Find the GDB manual and other documentation resources online at:
> .
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from qemu-system-arm...(no debugging symbols found)...done.
> (gdb) r
> Starting program: /usr/bin/qemu-system-arm -machine virt -nographic
> -nographic -kernel helloer.bin
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [New Thread 0x7fffecc88700 (LWP 14033)]
> [New Thread 0x7fffd21fc700 (LWP 14034)]
> Bad ram pointer 0x1e8
>
> Thread 3 "qemu-system-arm" received signal SIGABRT, Aborted.
> [Switching to Thread 0x7fffd21fc700 (LWP 14034)]
> 0x72a1b428 in __GI_raise (sig=sig@entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> 54../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) bt
> #0  0x72a1b428 in __GI_raise (sig=sig@entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> #1  0x72a1d02a in __GI_abort () at abort.c:89
> #2  0x557687f1 in get_page_addr_code ()
> #3  0x5572d50c in ?? ()
> #4  0x5572e11b in cpu_arm_exec ()
> #5  0x55750252 in ?? ()
> #6  0x72db76ba in start_thread (arg=0x7fffd21fc700) at
> pthread_create.c:333
> #7  0x72aed41d in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
> (gdb)
>
>
> Thanks and Regards,
> Ajay


--
Alex Bennée



Re: [Qemu-devel] Crash when running hello-world unikernel for ARM

2018-04-09 Thread Ajay Garg
>
> qemu-system-x86_64 is expecting an x86 binary blob. I assume you need
> qemu-system-arm. More importantly you need to specify a -M machine type
> that matches whatever rumprun is expecting.
>

Oops, sorry my bad.
Here is the updated status :

ajay@latitude-3480:~/rumprun-arm-hw/rumprun$ qemu-system-arm -machine
virt -nographic -nographic -kernel helloer.bin
Bad ram pointer 0x1e8
Aborted (core dumped)


ajay@latitude-3480:~/rumprun-arm-hw/rumprun$ gdb --args
qemu-system-arm -machine virt -nographic -nographic -kernel
helloer.bin
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from qemu-system-arm...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/qemu-system-arm -machine virt -nographic
-nographic -kernel helloer.bin
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffecc88700 (LWP 14033)]
[New Thread 0x7fffd21fc700 (LWP 14034)]
Bad ram pointer 0x1e8

Thread 3 "qemu-system-arm" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd21fc700 (LWP 14034)]
0x72a1b428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
54../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x72a1b428 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
#1  0x72a1d02a in __GI_abort () at abort.c:89
#2  0x557687f1 in get_page_addr_code ()
#3  0x5572d50c in ?? ()
#4  0x5572e11b in cpu_arm_exec ()
#5  0x55750252 in ?? ()
#6  0x72db76ba in start_thread (arg=0x7fffd21fc700) at
pthread_create.c:333
#7  0x72aed41d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)


Thanks and Regards,
Ajay



Re: [Qemu-devel] Crash when running hello-world unikernel for ARM

2018-04-09 Thread Alex Bennée

Ajay Garg  writes:

> Hi All.
>
> We did the following :
>
> a)
> Cross-compile rumprun for ARM on a linux x86_64 :
>
> ajay@latitude-3480:~/rumprun-arm-hw/rumprun$
> CC=arm-linux-gnueabihf-gcc ./build-rr.sh hw

>
> c)
> Tried running on x86_64, via qemu, but got the crash :
>
> ##
> ajay@latitude-3480:~/rumprun-arm-hw/rumprun$ qemu-system-x86_64
> -nographic -kernel helloer.bin
> warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
> qemu: fatal: Trying to execute code outside RAM or ROM at 0x000a01f1
>

>
>
> Where should we be looking to start to fix?

qemu-system-x86_64 is expecting an x86 binary blob. I assume you need
qemu-system-arm. More importantly you need to specify a -M machine type
that matches whatever rumprun is expecting.

--
Alex Bennée