unikraft / run-app-elfloader

Run Unikraft ELF Loader app on Linux executables
13 stars 11 forks source link

Running dynamic-apps helloworld binary on Ubuntu 22.04 container gives errors #9

Closed jobpaardekooper closed 1 year ago

jobpaardekooper commented 1 year ago

Trying to run helloworld from the dynamic-apps repo inside a ubuntu 22.04 docker container is giving me errors. Running with app-elfloader_kvm-x86_64 and app-elfloader_kvm-x86_64_full-debug both give different errors.

I am running the container with the following command:

docker run --security-opt seccomp=unconfined --privileged --rm -it unikraft.org/hackathons/base:latest /bin/bash

Running cat /etc/os-release gives the following output:

PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

I cloned this repo and inside that folder I cloned the dynamic apps repo.

Running ./run.sh -k app-elfloader_kvm-x86_64 -r ./dynamic-apps/lang/c/ /lib64/ld-linux-x86-64.so.2 /helloworld gives the following output:

Output ``` SeaBIOS (version 1.15.0-1) Booting from ROM..Powered by o. .o _ _ __ _ Oo Oo ___ (_) | __ __ __ _ ' _) :_ oO oO ' _ `| | |/ / _)' _` | |_| _) oOo oOO| | | | | (| | | (_) | _) :_ OoOoO ._, ._:_:_,\_._, .__,_:_, \___) Epimetheus 0.12.0~9d9f7020 brk(NULL) = va:0x400200000 arch_prctl(0x3001, 0x40004fc90, ...) = Invalid argument (-22) openat(AT_FDCWD, "/helloworld", O_RDONLY|O_CLOEXEC) = fd:3 read(fd:3, "\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832 mmap(NULL, 4198424, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000002000 mmap(va:0x1000200000, 2101272, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 0) = va:0x1000200000 munmap(va:0x1000002000) = OK munmap(va:0x1000402000) = OK mprotect(va:0x1000201000, 2093056, PROT_NONE) = OK mmap(va:0x1000400000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 0) = va:0x1000400000 close(fd:3) = OK uname(utsname:{sysname="Unikraft", nodename="unikraft", ...}) = OK access("/etc/ld.so.preload", R_OK) = No such file or directory (-2) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = No such file or directory (-2) newfstatat(0xffffff9c, 0x40004edf0, ...) = No such file or directory (-2) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = fd:3 read(fd:3, "\x7FELF\x02\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832 newfstatat(0x3, 0x4000afee9, ...) = 0x0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000002000 mmap(NULL, 6228704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000402000 mmap(va:0x1000600000, 4131552, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 0) = va:0x1000600000 munmap(va:0x1000402000) = OK munmap(va:0x10009f1000) = OK mprotect(va:0x10007e7000, 2097152, PROT_NONE) = OK mmap(va:0x10009e7000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 1994752) = va:0x10009e7000 mmap(va:0x10009ed000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, fd:-1, 0) = va:0x10009ed000 close(fd:3) = OK arch_prctl(0x1002, 0x1000003000, ...) = 0x0 set_tid_address(0x10000032d0, 0x1000003000, ...) = 0x0 set_robust_list(0x10000032e0, 0x18, ...) = Function not implemented (-38) rseq(0x10000039a0, 0x20, ...) = Function not implemented (-38) mprotect(va:0x10009e7000, 16384, PROT_READ) = OK mprotect(va:0x1000400000, 4096, PROT_READ) = OK mprotect(va:0x4000b9000, 8192, PROT_READ) = OK Inconsistency detected by ld.so: dl-call-libc-early-init.c: 37: _dl_call_libc_early_init: Assertion `sym != NULL' failed! writev(0x2, 0x40004f4d0, ...) = 0x7a ```

Running ./run.sh -k app-elfloader_kvm-x86_64_full-debug -r ./dynamic-apps/lang/c/ /lib64/ld-linux-x86-64.so.2 /helloworld gives the following output:

Output ``` SeaBIOS (version 1.15.0-1) Booting from ROM..[ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 285000 - 286000 (fl 0, 4096) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 286000 - 288000 (fl 1, 8192) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 288000 - 290000 (fl 3, 32768) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 290000 - 2a0000 (fl 4, 65536) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 2a0000 - 2c0000 (fl 5, 131072) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 2c0000 - 300000 (fl 6, 262144) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 300000 - 400000 (fl 8, 1048576) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 400000 - 800000 (fl 10, 4194304) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 800000 - 1000000 (fl 11, 8388608) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 1000000 - 2000000 (fl 12, 16777216) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 2000000 - 4000000 (fl 13, 33554432) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 4000000 - 8000000 (fl 14, 67108864) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 8000000 - 10000000 (fl 15, 134217728) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 10000000 - 20000000 (fl 16, 268435456) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 20000000 - 40000000 (fl 17, 536870912) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 40000000 - 60000000 (fl 17, 536870912) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 60000000 - 70000000 (fl 16, 268435456) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 70000000 - 78000000 (fl 15, 134217728) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 78000000 - 7c000000 (fl 14, 67108864) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7c000000 - 7e000000 (fl 13, 33554432) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7e000000 - 7f000000 (fl 12, 16777216) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7f000000 - 7f800000 (fl 11, 8388608) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7f800000 - 7fc00000 (fl 10, 4194304) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7fc00000 - 7fe00000 (fl 9, 2097152) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7fe00000 - 7ff00000 (fl 8, 1048576) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7ff00000 - 7ff80000 (fl 7, 524288) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7ff80000 - 7ffc0000 (fl 6, 262144) [ 0.000000] dbg: [libukfallocbuddy] ffffff8000264000: Adding physical memory 7ffc0000 - 7ffe0000 (fl 5, 131072) [ 0.000000] Info: [libkvmplat] Unikraft Epimetheus (0.12.0~fd5ac99c) [ 0.000000] Info: [libkvmplat] Architecture: x86_64 [ 0.000000] Info: [libkvmplat] Boot loader : qemu-multiboot [ 0.000000] Info: [libkvmplat] Command line: app-elfloader_kvm-x86_64_full-debug -- /helloworld [ 0.000000] Info: [libkvmplat] Boot memory map: [ 0.000000] Info: [libkvmplat] 000000100000-00000019c000 00000009c000 r-x 0000000000100000 krnl [ 0.000000] Info: [libkvmplat] 00000019c000-0000001b9000 00000001d000 r-- 000000000019c000 krnl [ 0.000000] Info: [libkvmplat] 0000001b9000-000000217000 00000005e000 rw- 00000000001b9000 krnl [ 0.000000] Info: [libkvmplat] 0000001b80e0-0000001b90e0 000000001000 rw- 00000000001b80e0 krnl [ 0.000000] Info: [libkvmplat] 00000021702c-00000021705e 000000000032 r-- 000000000021702c cmdl [ 0.000000] Info: [libkvmplat] 000000218000-000000252d28 00000003ad28 r-- 0000000000218000 ramd [ 0.000000] Info: [libkvmplat] 000000253000-000000254000 000000001000 rw- 0000000000253000 cmdl [ 0.000000] Info: [libkvmplat] 000000254000-000000264000 000000010000 rw- 0000000000254000 stck [ 0.000000] Info: [libkvmplat] 000000264000-00007ffe0000 00007fd7c000 --- ffffffffffffffff [ 0.000000] Info: [libkvmplat] 00007ffe0000-000080000000 000000020000 r-- 000000007ffe0000 rsvd [ 0.000000] Info: [libkvmplat] 0000feffc000-0000ff000000 000000004000 r-- 00000000feffc000 rsvd [ 0.000000] Info: [libkvmplat] 0000fffc0000-000100000000 000000040000 r-- 00000000fffc0000 rsvd [ 0.000000] Info: [libkvmplat] SYSCALL entrance @ 0x105072 [ 0.000000] Info: [libkvmplat] Switch from bootstrap stack to stack @0x264000 [ 0.000000] Info: [libukboot] Unikraft constructor table at 0x1b8000 - 0x1b8050 [ 0.000000] dbg: [libukboot] Call constructor: 0x19a770())... [ 0.000000] dbg: [libcontext] Load/store of extended CPU state: FXSAVE [ 0.000000] dbg: [libukboot] Call constructor: 0x1122f0())... [ 0.000000] dbg: [libukboot] Call constructor: 0x112d00())... [ 0.000000] dbg: [libukboot] Call constructor: 0x114d30())... [ 0.000000] dbg: [libukboot] Call constructor: 0x152180())... [ 0.000000] Info: [libuklibparam] libname: netdev, 72 [ 0.000000] dbg: [libukboot] Call constructor: 0x1657b0())... [ 0.000000] dbg: [libukboot] Call constructor: 0x1735f0())... [ 0.000000] Info: [libuklibparam] libname: vfs, 96 [ 0.000000] dbg: [libukboot] Call constructor: 0x110f60())... [ 0.000000] dbg: [libukbus] Register bus handler: 0x1b9000 [ 0.000000] dbg: [libukboot] Call constructor: 0x111670())... [ 0.000000] dbg: [libukbus] Register bus handler: 0x1b9060 [ 0.000000] dbg: [libukboot] Call constructor: 0x12c450())... [ 0.000000] dbg: [libuklibparam] Library argument ends at 0 [ 0.000000] Info: [libukboot] Found 1 library args [ 0.000000] Info: [libukboot] Initialize memory allocator... [ 0.000000] Info: [libukallocbbuddy] Initialize binary buddy allocator 400000000 [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400002000 - 400004000 (order 1) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400004000 - 400008000 (order 2) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400008000 - 400010000 (order 3) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400020000 - 400040000 (order 5) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400040000 - 400080000 (order 6) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400080000 - 400100000 (order 7) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400100000 - 400200000 (order 8) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400200000 - 400400000 (order 9) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400400000 - 400800000 (order 10) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 400800000 - 401000000 (order 11) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 401000000 - 402000000 (order 12) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 402000000 - 404000000 (order 13) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 404000000 - 408000000 (order 14) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 408000000 - 410000000 (order 15) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 410000000 - 420000000 (order 16) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 420000000 - 440000000 (order 17) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 440000000 - 460000000 (order 17) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 460000000 - 470000000 (order 16) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 470000000 - 478000000 (order 15) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 478000000 - 47c000000 (order 14) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 47c000000 - 47e000000 (order 13) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 47e000000 - 47f000000 (order 12) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 47f000000 - 47f800000 (order 11) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 47f800000 - 47f900000 (order 8) [ 0.000000] dbg: [libukallocbbuddy] 400000000: Add allocate unit 47f900000 - 47f940000 (order 6) [ 0.000000] dbg: [libcontext] tls_area_init: target: 0x400003020 (376 bytes) [ 0.000000] dbg: [libcontext] tls_area_init: copy (.tdata): 4 bytes [ 0.000000] dbg: [libcontext] tls_area_init: uninitialized (.tbss): 364 bytes [ 0.000000] dbg: [libcontext] tls_area_init: pad: 0 bytes [ 0.000000] dbg: [libcontext] tls_area_init: tcb: 8 bytes [ 0.000000] dbg: [libcontext] tls_area_init: tcb self ptr: 0x400003190 [ 0.000000] dbg: [libcontext] (tls_area): 400003020 0d f0 b0 b0 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.000000] dbg: [libcontext] (tls_area): 400003030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.000000] dbg: [libcontext] * [ 0.000000] dbg: [libcontext] (tls_area): 400003190 90 31 00 00 04 00 00 00 |.1......| [ 0.000000] Info: [libukboot] Initialize IRQ subsystem... [ 0.000000] Info: [libukboot] Initialize platform time... [ 0.000000] Info: [libkvmplat] Calibrating TSC clock against i8254 timer [ 0.100000] Info: [libkvmplat] Clock source: TSC, frequency estimate is 3407627700 Hz [ 0.107433] Info: [libukboot] Initialize scheduling... [ 0.112534] Info: [libukschedcoop] Initializing cooperative scheduler [ 0.118886] dbg: [libuksched] uk_thread 0x4000040b0 (idle): ctx:0x4000040b0, ectx:0x4000051a0, tlsp:0x400005190 [ 0.128201] dbg: [libcontext] tls_area_init: target: 0x400005020 (376 bytes) [ 0.135183] dbg: [libcontext] tls_area_init: copy (.tdata): 4 bytes [ 0.141504] dbg: [libcontext] tls_area_init: uninitialized (.tbss): 364 bytes [ 0.148240] dbg: [libcontext] tls_area_init: pad: 0 bytes [ 0.153709] dbg: [libcontext] tls_area_init: tcb: 8 bytes [ 0.159178] dbg: [libcontext] tls_area_init: tcb self ptr: 0x400005190 [ 0.165425] dbg: [libcontext] (tls_area): 400005020 0d f0 b0 b0 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.175475] dbg: [libcontext] (tls_area): 400005030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.185550] dbg: [libcontext] * [ 0.189024] dbg: [libcontext] (tls_area): 400005190 90 51 00 00 04 00 00 00 |.Q......| [ 0.198540] dbg: [libcontext] ukarch_ctx 0x4000040b0: entry:0x156aa0(400004018), sp:0x400030018 [ 0.206516] dbg: [libuksched] uk_thread 0x4000040b0 (idle) init: Call initialization 0x1258a0()... [ 0.214583] dbg: [libposix_process] thread 0x4000040b0 (idle): Parent 0 () has no PID, skipping... [ 0.223248] dbg: [libuksched] uk_thread 0x400006018 (init): ctx:0x400006018, ectx:0x4000060d0, tlsp:0x400003190 [ 0.232907] dbg: [libuksched] uk_thread 0x400006018 (init) init: Call initialization 0x1258a0()... [ 0.241215] dbg: [libposix_process] thread 0x400006018 (init): Parent 0 () has no PID, skipping... [ 0.250169] Info: [libukboot] Init Table @ 0x1b8050 - 0x1b8080 [ 0.256145] dbg: [libukboot] Call init function: 0x127eb0()... [ 0.261985] dbg: [libposix_socket] Installing socket family: 2 library: liblwip (0x1c2020) [ 0.269778] dbg: [libukboot] Call init function: 0x15ee80()... [ 0.275635] dbg: [libvfscore] (int) uk_syscall_r_dup2((int) 0x0, (int) 0x1) [ 0.282460] dbg: [libvfscore] (int) uk_syscall_r_dup3((int) 0x0, (int) 0x1, (int) 0x0) [ 0.289872] dbg: [libvfscore] (int) uk_syscall_r_dup2((int) 0x0, (int) 0x2) [ 0.296809] dbg: [libvfscore] (int) uk_syscall_r_dup3((int) 0x0, (int) 0x2, (int) 0x0) [ 0.304194] dbg: [libukboot] Call init function: 0x1597d0()... [ 0.309945] Info: [libukswrand] Initialize random number generator... [ 0.316451] dbg: [libukboot] Call init function: 0x14bee0()... [ 0.322196] Info: [libukbus] Initialize bus handlers... [ 0.327486] dbg: [libukbus] Initialize bus handler 0x1b9000... [ 0.333269] dbg: [libukbus] Initialize bus handler 0x1b9060... [ 0.339094] Info: [libuk9p] <9pdev_trans.c @ 59> Registered transport virtio [ 0.344797] Info: [libukbus] Probe buses... [ 0.348916] dbg: [libukbus] Probe bus 0x1b9000... [ 0.353638] dbg: [libkvmpci] Probe PCI [ 0.358366] Info: [libkvmpci] PCI 00:00.00 (0600 8086:1237): [ 0.365475] Info: [libkvmpci] PCI 00:01.00 (0600 8086:7000): [ 0.372513] Info: [libkvmpci] PCI 00:02.00 (0000 1af4:1009): driver 0x1b90a0 [ 0.379731] Info: [libkvmvirtio] Added virtio-pci device 1009 [ 0.385681] Info: [libkvmvirtio] Added virtio-pci subsystem_device_id 0009 [ 0.393072] Info: [libkvmvirtio] Virtio device 0x400008018 initialized [ 0.399736] Info: [libkvmvirtio9p] virtio-9p: Configured: features=0x1 tag=fs0 [ 0.407367] Info: [libkvmvirtio9p] virtio-9p: fs0 started [ 0.413922] dbg: [libukbus] Probe bus 0x1b9060... [ 0.418719] dbg: [libukboot] Call init function: 0x180960()... [ 0.424635] Info: [liblwip] Initializing lwip [ 0.429337] dbg: [libukmpi] Created mailbox 0x47f900018 [ 0.434559] dbg: [libuksched] uk_thread 0x47f901018 (lwip): ctx:0x47f901018, ectx:0x47f9021a0, tlsp:0x47f902190 [ 0.444014] dbg: [libcontext] tls_area_init: target: 0x47f902020 (376 bytes) [ 0.449431] dbg: [libcontext] tls_area_init: copy (.tdata): 4 bytes [ 0.454363] dbg: [libcontext] tls_area_init: uninitialized (.tbss): 364 bytes [ 0.459786] dbg: [libcontext] tls_area_init: pad: 0 bytes [ 0.464183] dbg: [libcontext] tls_area_init: tcb: 8 bytes [ 0.468528] dbg: [libcontext] tls_area_init: tcb self ptr: 0x47f902190 [ 0.473518] dbg: [libcontext] (tls_area): 47f902020 0d f0 b0 b0 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.481378] dbg: [libcontext] (tls_area): 47f902030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.489226] dbg: [libcontext] * [ 0.492100] dbg: [libcontext] (tls_area): 47f902190 90 21 90 7f 04 00 00 00 |.!......| [ 0.499676] dbg: [libuksched] uk_thread 0x47f901018 (lwip) init: Call initialization 0x1258a0()... [ 0.506450] dbg: [libposix_process] thread 0x47f901018 (lwip): Parent 0x400006018 (init) has no PID, skipping... [ 0.514078] dbg: [libcontext] ukarch_ctx 0x47f901018: entry:0x192b90(0), sp:0x47f930018 [ 0.520128] dbg: [libukboot] Call init function: 0x173630()... [ 0.524804] Info: [libvfscore] Mount 9pfs to /... [ 0.528763] dbg: [libvfscore] (int) uk_syscall_r_mount((const char*) 0x1a9554, (const char*) 0x1a9885, (const char*) 0x1a5a51, (unsigned long) 0x0, (const void*) 0x1a9269) [ 0.539792] Info: [libvfscore] VFS: mounting 9pfs at / [ 0.544195] dbg: [libuk9p] <9p.c @ 101> TVERSION msize 520192 version 9P2000.u [ 0.549041] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 0.554530] dbg: [libkvmvirtio9p] notify queue 0 [ 0.558764] dbg: [libuk9p] <9p.c @ 111> RVERSION msize 520192 version 9P2000.u [ 0.563493] dbg: [libuk9p] <9p.c @ 152> TATTACH fid 0 afid 4294967295 uname aname n_uname 4294967295 [ 0.569583] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 0.575074] dbg: [libkvmvirtio9p] notify queue 0 [ 0.579508] dbg: [libuk9p] <9p.c @ 167> RATTACH qid type 128 version 1680601232 path 31400744 Powered by o. .o _ _ __ _ Oo Oo ___ (_) | __ __ __ _ ' _) :_ oO oO ' _ `| | |/ / _)' _` | |_| _) oOo oOO| | | | | (| | | (_) | _) :_ OoOoO ._, ._:_:_,\_._, .__,_:_, \___) Epimetheus 0.12.0~fd5ac99c [ 0.599200] Info: [libukboot] Pre-init table at 0x1b80c8 - 0x1b80c8 [ 0.604089] Info: [libukboot] Constructor table at 0x1b80c8 - 0x1b80d0 [ 0.609245] dbg: [libukboot] Call constructor: 0x19af20()... [ 0.613646] Info: [libukboot] Calling main(2, ['app-elfloader_kvm-x86_64_full-debug', '/helloworld']) [ 0.620582] dbg: [appelfloader] Searching for image... [ 0.624762] Info: [appelfloader] Image at 0x218000, len 240936 bytes [ 0.629848] dbg: [libuksched] uk_thread 0x47f914018 (elfapp): ctx:0x47f914018, ectx:0x47f9151a0, tlsp:0x47f915190 [ 0.637436] dbg: [libcontext] tls_area_init: target: 0x47f915020 (376 bytes) [ 0.642986] dbg: [libcontext] tls_area_init: copy (.tdata): 4 bytes [ 0.647835] dbg: [libcontext] tls_area_init: uninitialized (.tbss): 364 bytes [ 0.653257] dbg: [libcontext] tls_area_init: pad: 0 bytes [ 0.657659] dbg: [libcontext] tls_area_init: tcb: 8 bytes [ 0.662119] dbg: [libcontext] tls_area_init: tcb self ptr: 0x47f915190 [ 0.667251] dbg: [libcontext] (tls_area): 47f915020 0d f0 b0 b0 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.675290] dbg: [libcontext] (tls_area): 47f915030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| [ 0.683191] dbg: [libcontext] * [ 0.686005] dbg: [libcontext] (tls_area): 47f915190 90 51 91 7f 04 00 00 00 |.Q......| [ 0.693516] dbg: [libuksched] uk_thread 0x47f914018 (elfapp) init: Call initialization 0x1258a0()... [ 0.700508] dbg: [libposix_process] thread 0x47f914018 (elfapp): Parent 0x400006018 (init) has no PID, skipping... [ 0.708317] dbg: [appelfloader] Load image... [ 0.712022] dbg: [appelfloader] 0x218000: ELF machine type: 62 [ 0.717055] dbg: [appelfloader] 0x218000: ELF OS ABI: 3 [ 0.721556] dbg: [appelfloader] 0x218000: ELF object type: 3 [ 0.726546] dbg: [appelfloader] 0x218000: phdr[0]: R--, offset: 0, vaddr: 0, paddr: 0, filesz: 6992 B, memsz 6992 B, align: 4096 B [ 0.735279] dbg: [appelfloader] 0x218000: \_ segment at pie + 0x0 (len: 0x1b50) from file @ 0x0 (len: 0x1b50) [ 0.742848] dbg: [appelfloader] 0x218000: \_ base: pie + 0x0 (len: 0x1b50) [ 0.748672] dbg: [appelfloader] 0x218000: phdr[1]: R-X, offset: 0x2000, vaddr: 0x2000, paddr: 0x2000, filesz: 168757 B, memsz 168757 B, align: 4096 B [ 0.758635] dbg: [appelfloader] 0x218000: \_ segment at pie + 0x2000 (len: 0x29335) from file @ 0x2000 (len: 0x29335) [ 0.766725] dbg: [appelfloader] 0x218000: \_ base: pie + 0x0 (len: 0x2b335) [ 0.772355] dbg: [appelfloader] 0x218000: phdr[2]: R--, offset: 0x2c000, vaddr: 0x2c000, paddr: 0x2c000, filesz: 44772 B, memsz 44772 B, align: 4096 B [ 0.782359] dbg: [appelfloader] 0x218000: \_ segment at pie + 0x2c000 (len: 0xaee4) from file @ 0x2c000 (len: 0xaee4) [ 0.790358] dbg: [appelfloader] 0x218000: \_ base: pie + 0x0 (len: 0x36ee4) [ 0.795994] dbg: [appelfloader] 0x218000: phdr[3]: RW-, offset: 0x37620, vaddr: 0x38620, paddr: 0x38620, filesz: 10992 B, memsz 11448 B, align: 4096 B [ 0.806054] dbg: [appelfloader] 0x218000: \_ segment at pie + 0x38620 (len: 0x2cb8) from file @ 0x37620 (len: 0x2af0) [ 0.814032] dbg: [appelfloader] 0x218000: \_ base: pie + 0x0 (len: 0x3b2d8) [ 0.819741] dbg: [appelfloader] 0x218000: Program/Library memory region: 0x400081000-0x4000bc2d8 [ 0.826692] dbg: [appelfloader] 0x218000: Copying 0x218000 - 0x219b50 -> 0x400081000 - 0x400082b50 [ 0.833806] dbg: [appelfloader] 0x218000: Zeroing 0x400082b50 - 0x400082b50 [ 0.839499] dbg: [appelfloader] 0x218000: Protecting 0x400081000 - 0x400083000: R-- [ 0.845530] dbg: [appelfloader] 0x218000: Copying 0x21a000 - 0x243335 -> 0x400083000 - 0x4000ac335 [ 0.852793] dbg: [appelfloader] 0x218000: Zeroing 0x4000ac335 - 0x4000ac335 [ 0.858349] dbg: [appelfloader] 0x218000: Protecting 0x400083000 - 0x4000ad000: R-X [ 0.864287] dbg: [appelfloader] 0x218000: Copying 0x244000 - 0x24eee4 -> 0x4000ad000 - 0x4000b7ee4 [ 0.871291] dbg: [appelfloader] 0x218000: Zeroing 0x4000b7ee4 - 0x4000b7ee4 [ 0.877187] dbg: [appelfloader] 0x218000: Protecting 0x4000ad000 - 0x4000b8000: R-- [ 0.883206] dbg: [appelfloader] 0x218000: Copying 0x24f620 - 0x252110 -> 0x4000b9620 - 0x4000bc110 [ 0.890125] dbg: [appelfloader] 0x218000: Zeroing 0x4000bc110 - 0x4000bc2d8 [ 0.895662] dbg: [appelfloader] 0x218000: Protecting 0x4000b9000 - 0x4000bd000: RW- [ 0.901738] Info: [appelfloader] ELF program loaded to 0x400081000-0x4000bc2d8 (242392 B), entry at 0x4000a12b0 [ 0.909092] dbg: [appelfloader] Prepare application thread... [ 0.913874] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: image: 0x400081000 - 0x4000bc2d8 [ 0.921512] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: start: 0x400081000 [ 0.928191] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: entry: 0x4000a12b0 [ 0.935016] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: ehdr_phoff: 0x40 [ 0.941526] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: ehdr_phnum: 11 [ 0.947954] dbg: [appelfloader] app-elfloader_kvm-x86_64_full-debug: ehdr_phentsize: 0x38 [ 0.954385] dbg: [libcontext] ukarch_ctx 0x47f914018: start:0x4000a12b0 sp:0x40004fe50 [ 0.960417] dbg: [libposix_process] Process PID 0: New thread TID 0 [ 0.965527] dbg: [libposix_process] Process PID 0 created (parent PID: -1) [ 0.971278] dbg: [libposix_time] (int) uk_syscall_r_nanosleep((const struct timespec*) 0x263ef0, (struct timespec*) 0x263ef0) [ 0.979608] dbg: [appelfloader] (void *) uk_syscall_r_brk((void *) 0x0) [ 0.984786] dbg: [appelfloader] brk @ 0x400200000 (brk heap region: 0x400200000-0x400400000) brk(NULL) = va:0x400200000 [ 0.992741] dbg: [appelfloader] (long) uk_syscall_r_arch_prctl((long) 0x3001, (long) 0x40004fc90, (long) 0x4000a03e0) [ 1.001108] dbg: [appelfloader] arch_prctl option code 0x3001 ignored arch_prctl(0x3001, 0x40004fc90, ...) = Invalid argument (-22) [ 1.010236] dbg: [libvfscore] (int) uk_syscall_r_openat((int) 0xffffff9c, (const char *) 0x4000bc2e0, (int) 0x80000, (int) 0x0) [ 1.018687] dbg: [libvfscore] (int) uk_syscall_r_open((const char*) 0x4000bc2e0, (int) 0x80000, (mode_t) 0x0) [ 1.026020] dbg: [libuk9p] <9p.c @ 222> TWALK fid 0 newfid 1 nwname 1 name helloworld [ 1.031150] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 1.036535] dbg: [libkvmvirtio9p] notify queue 0 [ 1.040892] dbg: [libuk9p] <9p.c @ 244> RWALK nwqid 1 [ 1.044185] dbg: [libuk9p] <9p.c @ 516> TSTAT fid 1 [ 1.047390] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 1.052770] dbg: [libkvmvirtio9p] notify queue 0 [ 1.057253] dbg: [libuk9p] <9p.c @ 524> RSTAT [ 1.060190] dbg: [libuk9p] <9p.c @ 222> TWALK fid 1 newfid 2 nwname 0 name [ 1.065086] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 1.070540] dbg: [libkvmvirtio9p] notify queue 0 [ 1.074900] dbg: [libuk9p] <9p.c @ 244> RWALK nwqid 0 [ 1.078181] dbg: [libuk9p] <9p.c @ 276> TOPEN fid 2 mode 0 [ 1.081891] dbg: [libkvmvirtio] Old head:0, new head:2, total_desc:2 [ 1.087295] dbg: [libkvmvirtio9p] notify queue 0 [ 1.091776] dbg: [libuk9p] <9p.c @ 285> ROPEN qid type 0 version 1679523984 path 31344922 iounit 516096 openat(AT_FDCWD, "/helloworld", O_RDONLY|O_CLOEXEC) = fd:3 [ 1.101308] dbg: [libvfscore] (ssize_t) uk_syscall_r_read((int) 0x3, (void *) 0x40004f698, (size_t) 0x340) [ 1.108676] dbg: [libvfscore] (ssize_t) uk_syscall_r_readv((int) 0x3, (const struct iovec *) 0x40004f140, (int) 0x1) [ 1.116586] dbg: [libuk9p] <9p.c @ 448> TREAD fid 2 offset 0 count 832 [ 1.120882] dbg: [libkvmvirtio] Old head:0, new head:3, total_desc:3 [ 1.126417] dbg: [libkvmvirtio9p] notify queue 0 [ 1.130838] dbg: [libuk9p] <9p.c @ 463> RREAD count 832 read(fd:3, "\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832 [ 1.141184] dbg: [libposix_mmap] (void *) uk_syscall_e_mmap((void *) 0x0, (size_t) 0x401018, (int) 0x0, (int) 0x22, (int) 0xffffffff, (off_t) 0x0) mmap(NULL, 4198424, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, fd:-1, 0) = va:0x1000002000 [ 1.155879] dbg: [libposix_mmap] (void *) uk_syscall_e_mmap((void *) 0x1000200000, (size_t) 0x201018, (int) 0x5, (int) 0x812, (int) 0x3, (off_t) 0x0) [ 1.165603] dbg: [libuk9p] <9p.c @ 448> TREAD fid 2 offset 0 count 516096 [ 1.170220] dbg: [libkvmvirtio] Old head:0, new head:3, total_desc:3 [ 1.175655] dbg: [libkvmvirtio9p] notify queue 0 [ 1.180236] dbg: [libuk9p] <9p.c @ 463> RREAD count 8304 [ 1.183889] dbg: [libuk9p] <9p.c @ 448> TREAD fid 2 offset 8304 count 516096 [ 1.188606] dbg: [libkvmvirtio] Old head:0, new head:3, total_desc:3 [ 1.194024] dbg: [libkvmvirtio9p] notify queue 0 [ 1.198384] dbg: [libuk9p] <9p.c @ 463> RREAD count 0 mmap(va:0x1000200000, 2101272, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 0) = va:0x1000200000 [ 1.209611] dbg: [libposix_mmap] (int) uk_syscall_r_munmap((void *) 0x1000002000, (size_t) 0x1fe000) munmap(va:0x1000002000) = OK [ 1.218337] dbg: [libposix_mmap] (int) uk_syscall_r_munmap((void *) 0x1000402000, (size_t) 0x1018) munmap(va:0x1000402000) = OK [ 1.226760] dbg: [libposix_mmap] (int) uk_syscall_r_mprotect((void *) 0x1000201000, (size_t) 0x1ff000, (int) 0x0) mprotect(va:0x1000201000, 2093056, PROT_NONE) = OK [ 1.237533] dbg: [libposix_mmap] (void *) uk_syscall_e_mmap((void *) 0x1000400000, (size_t) 0x2000, (int) 0x3, (int) 0x812, (int) 0x3, (off_t) 0x0) [ 1.247178] dbg: [libuk9p] <9p.c @ 448> TREAD fid 2 offset 0 count 4096 [ 1.251682] dbg: [libkvmvirtio] Old head:0, new head:3, total_desc:3 [ 1.257334] dbg: [libkvmvirtio9p] notify queue 0 [ 1.261496] dbg: [libuk9p] <9p.c @ 463> RREAD count 4096 [ 1.265029] dbg: [libuk9p] <9p.c @ 448> TREAD fid 2 offset 4096 count 4096 [ 1.269700] dbg: [libkvmvirtio] Old head:0, new head:3, total_desc:3 [ 1.275078] dbg: [libkvmvirtio9p] notify queue 0 [ 1.279434] dbg: [libuk9p] <9p.c @ 463> RREAD count 4096 mmap(va:0x1000400000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 0) = va:0x1000400000 [ 1.289763] CRIT: [libkvmplat] Unhandled Trap 13 (general protection), error code=0x0 [ 1.295770] Info: [libkvmplat] Regs address 0x1eff50 [ 1.300014] CRIT: [libkvmplat] RIP: 000000040008a648 CS: 0008 [ 1.304717] CRIT: [libkvmplat] RSP: 000000040004f490 SS: 0010 EFLAGS: 00010286 [ 1.310520] CRIT: [libkvmplat] RAX: ffff2d7ce8000000 RBX: 000000006ffffdff RCX: 00000004000bc330 [ 1.317362] CRIT: [libkvmplat] RDX: 0000001000400f68 RSI: 0000000000000029 RDI: 000000006fffffff [ 1.324040] CRIT: [libkvmplat] RBP: 000000040004f5f0 R08: 0000001000200000 R09: 00000000effffef5 [ 1.330624] CRIT: [libkvmplat] R10: 0000000070000022 R11: 0000000000000032 R12: 000000006ffffeff [ 1.337356] CRIT: [libkvmplat] R13: 000000006ffffe35 R14: 000000006fffff41 R15: 00000004000bc2f0 [ 1.344081] CRIT: [libkvmplat] Crashing [ 1.347584] Info: [libkvmplat] Unikraft halted ```
razvand commented 1 year ago

Thanks, @jobpaardekooper.

Hackathon points: 10

jobpaardekooper commented 1 year ago

The issue was that it should be run should be run with the following command:

./run.sh -k app-elfloader_kvm-x86_64 -r ./dynamic-apps/lang/c/ ./dynamic-apps/lang/c/lib64/ld-linux-x86-64.so.2 /helloworld

It should use the loader that is inside the extracted folder and not the loader of the docker container itself.