Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solo5's ukvm-bin (soon to be called solo5-spt) should exit with with the correct rumprun's exit status #11

Open
ricarkol opened this issue Jan 24, 2019 · 0 comments

Comments

@ricarkol
Copy link
Contributor

ricarkol commented Jan 24, 2019

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
@ricarkol ricarkol changed the title The ukvm (soon to be called solo5-spt) process should exit with with the rumprun exit status ukvm-bin (soon to be called solo5-spt) should exit with with the rumprun exit status Jan 24, 2019
@ricarkol ricarkol changed the title ukvm-bin (soon to be called solo5-spt) should exit with with the rumprun exit status solo5's ukvm-bin (soon to be called solo5-spt) should exit with with the rumprun exit status Jan 24, 2019
@ricarkol ricarkol changed the title solo5's ukvm-bin (soon to be called solo5-spt) should exit with with the rumprun exit status solo5's ukvm-bin (soon to be called solo5-spt) should exit with with the correct rumprun's exit status Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant