seL4 / seL4

The seL4 microkernel

Home Page:https://sel4.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vm fault on data at address 0 with status 0x5

mttbx opened this issue · comments

I test sel4 on spike (riscv64). I link my app with libsel4 and sel4runtime.

add_executable(app main.c printf.c)
target_link_libraries(app PRIVATE sel4 sel4runtime)

set_property(
    TARGET app
    APPEND_STRING
    PROPERTY LINK_FLAGS " -nostartfiles -nostdlib -Wl,-Map=${CMAKE_CURRENT_LIST_DIR}/app.map "
)
    
include(rootserver)
DeclareRootserver(app)

And I get the error message:

ELF-loader started on (HART 0) (NODES 1)
  paddr=[80200000..802cbfff]
Looking for DTB in CPIO archive...found at 802b73b8.
Loaded DTB from 802b73b8.
   paddr=[84020000..84020fff]
ELF-loading image 'kernel' to 84000000
  paddr=[84000000..8401ffff]
  vaddr=[ffffffff84000000..ffffffff8401ffff]
  virt_entry=ffffffff84000000
ELF-loading image 'app' to 84021000
  paddr=[84021000..84039fff]
  vaddr=[10000..28fff]
  virt_entry=10f46
Enabling MMU and paging
Jumping to kernel-image entry point...

Init local IRQ
no PLIC present, skip hart specific initialisation
Bootstrapping kernel
Initializing PLIC...
no PLIC present, skip platform specific initialisation
available phys memory regions: 1
  [80200000..17ff00000]
reserved virt address space regions: 3
  [ffffffc084000000..ffffffc084020000]
  [ffffffc084020000..ffffffc084020425]
  [ffffffc084021000..ffffffc08403a000]
Booting all finished, dropped to user space
Caught cap fault in send phase at address 0
while trying to handle:
vm fault on data at address 0 with status 0x5
in thread 0xffffffc17fec7200 "rootserver" at address 0x1015a
With stack:
0x23e00: 0xfffffffffffffff2
0x23e08: 0x0
0x23e10: 0x0
0x23e18: 0x0
0x23e20: 0x0
0x23e28: 0x0
0x23e30: 0x0
0x23e38: 0x24000
0x23e40: 0x8
0x23e48: 0x23e50
0x23e50: 0x23e80
0x23e58: 0x11c44
0x23e60: 0x23e80
0x23e68: 0x1195c
0x23e70: 0x23eb0
0x23e78: 0x1161c

The entry address is correct (10f46):


 .text          0x0000000000010128      0x178 CMakeFiles/app.dir/main.c.obj
                0x000000000001020e                strcpy
                0x0000000000010260                _putc
                0x0000000000010282                main
 .text          0x00000000000102a0      0xca6 CMakeFiles/app.dir/printf.c.obj
                0x000000000001031c                _vsnprintf_direct
                0x0000000000010de2                _vsnprintf
                0x0000000000010e20                _sprintf
                0x0000000000010e82                _snprintf
                0x0000000000010ee8                _printf
 .text          0x0000000000010f46       0x16 sel4runtime/libsel4runtime.a(sel4_crt0.S.obj)
                0x0000000000010f46                _sel4_start
 .text          0x0000000000010f5c      0x142 sel4runtime/libsel4runtime.a(start_root.c.obj)
                0x0000000000010f5c                __sel4_start_root
 .text          0x000000000001109e       0x26 sel4runtime/libsel4runtime.a(vsyscall.c.obj)
                0x000000000001109e                __sel4runtime_vsyscall
                0x000000000001109e                sel4_vsyscall

my app:

#include <sel4/sel4.h>
#include "printf.h"

void _putc(char c) {
  seL4_DebugPutChar(c);
  //sbi_console_putchar(c);
}

int main(void)
{
  printf("hello world!\n");
  return 0;
}

Solved it. See Findmusllibc.cmake

Glad you resolved your problem and thanks for telling others how you fixed it.

However, like I said before, issues here should be about the seL4 kernel. Opening issues for user space problems encountered during development is not really appropriate. The exception is if you encounter problems with running unmodified sel4test or sel4bench, or if you suspect it is an actual kernel problem (e.g. it used to work but after an update it stopped working).

Thank you for the note. I'll rememer that.