You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.9 KiB

SLEdge only implemented a subset of the WASI syscall interface

Arguments

The WASI calls args_sizes_get and args_get are supported. HTTP query parameters are captured and passed as arguments.

Environment Variables

The WASI calls environ_get and environ_sizes_get are supported, but mostly unused. The current behavior is to to pass the runtime's environment variables into the sandbox. This is likely undesirable.

Presumably, the runtime should provide a standard set of environment variables and also allow the JSON spec to set additional function-specific environment variables.

See the reference of environment variables generated by WAGI for details: https://github.com/deislabs/wagi/blob/main/docs/environment_variables.md

Clocks

clock_time_get is implemented but untested. clock_res_get is unimplemented.

File System

SLEdge only supports fd_read from stdin and fd_write to stderr or stdout.

stdin is populated with the body of an HTTP POST request. stdout and stderr are both written in an interleaved fashion into a buffer and sent back to the client as the response body.

Actual access to the file system is unsupported, and sandboxes are not provided any preopened descriptors.

Poll

poll_oneoff is unsupposed because SLEdge serverless functions are short lived. Sandboxed functions are assumed to make blocking reads/writes to stdin/stdout/stderr, and the serverless runtime is responsible for causing serverless functions to sleep and wake.

Exit

proc_exit is supported and causes a sandbox to terminate execution.

Signals

proc_raise is not supported. Signals are used by the runtime to provide preemption and context switching. It would be dangerous to trigger actual host signals from a sandbox.

However, the function could be implemented by creating a switch on the wasi signal and either ignoring or handling the signal within the proc_raise function itself.

SIGABRT could trigger the sandbox to exit in an abnormal condition.

The default ignore behavior could log the unexpected signal and return.

Random

random_get is supported but largely untested.

Yield

sched_yield is unsupported. This does not match with the run-to-completion nature of serverless.

In the case of EDF, a sandbox would always yield to itself. However, in the case of FIFO, we could enable this call to allow for a worker to "round robin" within a runqueue. However, it is unclear what the rationale would be to allow a serverless function to impact the scheduler.

Sockets

All socket syscalls are unimplemented because the current logic around sock_accept and sock_shutdown seems to be focused on long-lived daemon nanoprocesses that handle multiple requests. The poll_oneoff call also seems to be based on this usecase.

Generally, a serverless function is expected to only make outbound network requests. However, this use case does not seem to be currently supported by WASI.