The exit status of a rumprun program should make it to the ukvm exit status. For example:
$ cat test.c
int main() {return 1;}
$ make test
$ ukvm ./test.bin
$ echo $?
0 <=== this should be 1 (right now it's always 0)
solo5 gets the return value via a solo5_exit(exit_value) call from the guest. solo5_exit effectively halts the guest which should be done at bmk_platform_halt (the very end of the rumprun execution). The issue is that by then we completely forgot the return value. Just for reference, here is a backtrace of solo5_exit: none of the parent functions know what the return value is.
(gdb) bt
#0 solo5_exit (status=0) at exit.c:24
#1 0x000000000010005c in bmk_platform_halt (panicstring=0x0) at kernel.c:54
#2 0x000000000010109a in rumpuser_exit (value=value@entry=0)
at /home/kollerr/research/nabla-base-build/rumprun/lib/libbmk_rumpuser/rumpuser_base.c:137
#3 0x00000000002e24b7 in cpu_reboot (howto=<optimized out>, bootstr=<optimized out>)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/emul.c:344
#4 0x000000000028ddc3 in sys_reboot (l=<optimized out>, uap=0x4affb0, retval=<optimized out>)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/../../../kern/kern_xxx.c:82
#5 0x00000000002e3184 in sy_call (rval=0x4affa0, uap=0x4affb0, l=0x6c8000, sy=<optimized out>)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/../../../sys/syscallvar.h:65
#6 sy_invoke (code=208, rval=0x4affa0, uap=0x4affb0, l=0x6c8000, sy=<optimized out>)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/../../../sys/syscallvar.h:94
#7 rump_syscall (num=num@entry=208, data=data@entry=0x4affb0, dlen=dlen@entry=16, retval=retval@entry=0x4affa0)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/rump.c:760
#8 0x00000000002d9ece in rump___sysimpl_reboot (opt=opt@entry=0, bootstr=bootstr@entry=0x0)
at /home/kollerr/research/nabla-base-build/rumprun/src-netbsd/sys/rump/librump/rumpkern/rump_syscalls.c:2481
#9 0x00000000002e7202 in rumprun_reboot () at /home/kollerr/research/nabla-base-build/rumprun/lib/librumprun_base/rumprun.c:378
#10 0x00000000002e6b87 in bmk_mainthread (cmdline=<optimized out>)
at /home/kollerr/research/nabla-base-build/rumprun/lib/librumprun_base/main.c:81
#11 0x00000000001018a8 in bmk_cpu_sched_bouncer ()
#12 0x0000000000000000 in ?? ()
The return value was set somewhere way before calling bmk_platform_halt, somewhere here:
=== calling "rumprun" main() ===
hello, c++
=== main() of "rumprun" returned 1 ===
=== ERROR: _exit(1) called === <=================== here is where we actually have the exit value
rump kernel halting...
syncing disks... done
unmounting file systems...
unmounted tmpfs on /tmp type tmpfs
unmounted rumpfs on / type rumpfs
unmounting done
halted
Solo5: solo5_exit(0) called <============== this is where we are doing `solo5_exit` and where we should have the exit value
The exit status of a rumprun program should make it to the ukvm exit status. For example:
solo5 gets the return value via a
solo5_exit(exit_value)call from the guest.solo5_exiteffectively halts the guest which should be done atbmk_platform_halt(the very end of the rumprun execution). The issue is that by then we completely forgot the return value. Just for reference, here is a backtrace ofsolo5_exit: none of the parent functions know what the return value is.The return value was set somewhere way before calling
bmk_platform_halt, somewhere here: