Describe the bug
Enabling LIBPOSIX_PROCESS_SIGNAL (and disabling LIBUKSIGNAL), with the application making calls to signal-related functions, will cause a stack overflow:
[ 1.378739] CRIT: [libukvmem] Guard page 0x10000c3000 of stack VMA 0x10000c3000 - 0x10000d8000 hit!
rt_sigaction(0xb, 0x10000ffdb0, ...) = 0x0
[ 1.381522] CRIT: [libukvmem] Guard page 0x10000c3000 of stack VMA 0x10000c3000 - 0x10000d8000 hit!
[ 1.383468] CRIT: [libposix_process] Cannot deliver SIGSEGV for pf at 0x10000c3af8
This can be fixed by increasing the stack size, i.e. adding / updating the lines below in the Kraftfile:
CONFIG_STACK_SIZE_PAGE_ORDER: 5
CONFIG_AUXSTACK_SIZE_PAGE_ORDER: 5
Steps to reproduce
Run the tokio1-rust1.75 example in the catalog repository; other examples running in bincompat (mostly Rust, Node or Python-based would also fail). Run the commands below (or add them to a script:
# Remove previous clone, if any.
rm -fr catalog
# Clone repository.
git clone https://github.com/unikraft/catalog catalog
# Update base Kraftfile configuration.
sed -i "/CONFIG_LIBPOSIX_PROCESS_MULTITHREADING.*$/a\\
CONFIG_LIBPOSIX_PROCESS_CLONE: 'y'\n\
CONFIG_LIBPOSIX_PROCESS_SIGNAL: 'y'\n\
CONFIG_LIBPOSIX_PROCESS_MAX_PID: '48'" catalog/library/base/Kraftfile
sed -i "/CONFIG_STACK_SIZE_PAGE_ORDER.*$/a\\
CONFIG_AUXSTACK_SIZE_PAGE_ORDER: 5'" catalog/library/base/Kraftfile
# Update runtime in example configuration to point to updated base.
sed -i "s/^runtime:.*/runtime: local-base:latest/" catalog/examples/tokio1-rust1.75/Kraftfile
# Build and package base.
cd catalog/library/base
rm -fr .config* .unikraft
kraft build --log-level debug --log-type basic --no-cache --no-update --plat qemu --arch x86_64 .
kraft pkg --name "local-base:latest" --plat qemu --arch x86_64
# Run example.
cd ../../examples/tokio1-rust1.75
memory="512Mi"
ports="8080:8080"
kraft run --log-level debug --log-type basic --rm --plat qemu --arch x86_64 --memory "$memory" --port "$ports" .
Note that updating the catalog/library/base/Kraftfile to:
CONFIG_STACK_SIZE_PAGE_ORDER: 5 # 128 * 4K = 512K
will make things work. You will have to, of course, rebuild and repackage base and rerun the application:
# Build and package base.
cd catalog/library/base
rm -fr .config* .unikraft
kraft build --log-level debug --log-type basic --no-cache --no-update --plat qemu --arch x86_64 .
kraft pkg --name "local-base:latest" --plat qemu --arch x86_64
# Run example.
cd ../../examples/tokio1-rust1.75
memory="512Mi"
ports="8080:8080"
kraft run --log-level debug --log-type basic --rm --plat qemu --arch x86_64 --memory "$memory" --port "$ports" .
Expected behavior
The application should work, giving out an output such as:
en1: Interface is up
en1: Set IPv4 address 10.0.2.15 mask 255.255.255.0 gw 10.0.2.2
Powered by Unikraft Pan (0.19.1~1d3ad9d)
Listening on: http://0.0.0.0:8080
[...]
Which architectures were you using or does this bug affect?
x86_64
Which platforms were you using or does this bug affect?
kvm
Relevant log output
[ 1.378739] CRIT: [libukvmem] Guard page 0x10000c3000 of stack VMA 0x10000c3000 - 0x10000d8000 hit!
rt_sigaction(0xb, 0x10000ffdb0, ...) = 0x0
[ 1.381522] CRIT: [libukvmem] Guard page 0x10000c3000 of stack VMA 0x10000c3000 - 0x10000d8000 hit!
[ 1.383468] CRIT: [libposix_process] Cannot deliver SIGSEGV for pf at 0x10000c3af8
Describe the bug
Enabling
LIBPOSIX_PROCESS_SIGNAL(and disablingLIBUKSIGNAL), with the application making calls to signal-related functions, will cause a stack overflow:This can be fixed by increasing the stack size, i.e. adding / updating the lines below in the
Kraftfile:Steps to reproduce
Run the
tokio1-rust1.75example in thecatalogrepository; other examples running in bincompat (mostly Rust, Node or Python-based would also fail). Run the commands below (or add them to a script:Note that updating the
catalog/library/base/Kraftfileto:will make things work. You will have to, of course, rebuild and repackage
baseand rerun the application:Expected behavior
The application should work, giving out an output such as:
Which architectures were you using or does this bug affect?
x86_64
Which platforms were you using or does this bug affect?
kvm
Relevant log output