You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.
The variables fd, nchanges, nevents are 32 bit in go BUT are 64 bit in C.
When they are copied to the stack as arguments, they take 8 bytes from the stack (as this is 64bit), but only 4 bytes are copied. leaving 4 bytes of garbage.
If the garbage is not zero, the c system call gets the wrong value for the variable.
in my case, i had
nchanges = 0x2100000000
while changelist was null, and hense the EFAULT error (number 14)
As a hacky solution, I modified runtime·kevent in runtime/sys_rumprun_amd64.s right after the line ADDQ $0x18, SI // args
I added:
ehh.. this is unfortunate - since this is isolated to a rumprun file want to open a pull request for now? this sounds like something that should change in the go calling code later on though
To reproduce, run a go http server (i used the one here: https://github.com/emc-advanced-dev/unik/tree/master/docs/examples/example_go_httpd)
and perform a lot of requests:
while true; do curl http://192.168.4.141:8080/ ; done
(192.168.4.141 is the address of the rumprun unikernel in my setup)This issue happens due to a mismatch in assembly calling conventions.
In go:
in c (rumprun/src-netbsd/sys/kern/kern_event.c):
The variables fd, nchanges, nevents are 32 bit in go BUT are 64 bit in C.
When they are copied to the stack as arguments, they take 8 bytes from the stack (as this is 64bit), but only 4 bytes are copied. leaving 4 bytes of garbage.
If the garbage is not zero, the c system call gets the wrong value for the variable.
in my case, i had
nchanges = 0x2100000000
while changelist was null, and hense the EFAULT error (number 14)
As a hacky solution, I modified runtime·kevent in runtime/sys_rumprun_amd64.s right after the line
ADDQ $0x18, SI // args
I added:
to zero out the garbage part of the stack.
The text was updated successfully, but these errors were encountered: