unikraft / static-pie-apps

Built Linux applications (static-pie) for Unikraft binary compatibility mode
7 stars 40 forks source link

Caddy server static PIE (go) fails to start: `fatal error: failed to reserve page summary memory` #76

Open bttger opened 1 year ago

bttger commented 1 year ago

Describe the bug The caddy server built with go fails to start due to the following error:

[    0.171790] CRIT: [appelfloader] <brk.c @   27> Cannot handle multiple user space heaps: Not implemented!
[    0.176019] CRIT: [appelfloader] <brk.c @   44> Failed to increase heap: Not implemented!
fatal error: failed to reserve page summary memory

runtime stack:
runtime.throw({0x398d21a9?, 0x3ff8fb30?})
    /usr/lib/go/src/runtime/panic.go:1047 +0x5f fp=0x3ff8fae0 sp=0x3ff8fab0 pc=0x384becbf
runtime.(*pageAlloc).sysInit(0x3ac6e710)
    /usr/lib/go/src/runtime/mpagealloc_64bit.go:82 +0x195 fp=0x3ff8fb68 sp=0x3ff8fae0 pc=0x384b3475
runtime.(*pageAlloc).init(0x3ac6e710, 0x3ac6e700, 0x0?)
    /usr/lib/go/src/runtime/mpagealloc.go:324 +0x70 fp=0x3ff8fb90 sp=0x3ff8fb68 pc=0x384b10d0
runtime.(*mheap).init(0x3ac6e700)
    /usr/lib/go/src/runtime/mheap.go:721 +0x13f fp=0x3ff8fbc8 sp=0x3ff8fb90 pc=0x384ae4df
runtime.mallocinit()
    /usr/lib/go/src/runtime/malloc.go:407 +0xb2 fp=0x3ff8fbf0 sp=0x3ff8fbc8 pc=0x384910f2
runtime.schedinit()
    /usr/lib/go/src/runtime/proc.go:693 +0xab fp=0x3ff8fc50 sp=0x3ff8fbf0 pc=0x384c268b
runtime.rt0_go()
    /usr/lib/go/src/runtime/asm_amd64.s:345 +0x120 fp=0x3cd Documents/munich-hack-challenges/apps/run-app-elfloader

To Reproduce Steps to reproduce the behavior:

  1. Set up the correct directory structure (clone the repositories, see snippet below)
  2. Build the caddy server static PIE executable
  3. Run it with ./run_elfloader ../static-pie-apps/caddy/caddy-2.6.2/cmd/caddy/caddy
  4. See error
# dir structure:
.
├── apps
│   ├── app-elfloader
│   ├── run-app-elfloader
│   └── static-pie-apps
├── libs
│   ├── lib-libelf
│   ├── lib-lwip
│   └── lib-zydis
└── unikraft
     ├── ...

Expected behavior I expect it to run without errors.

Desktop (please complete the following information):