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

Add invariants on Wasm Execution #3671

Open
mariaschett opened this issue Feb 8, 2023 · 4 comments
Open

Add invariants on Wasm Execution #3671

mariaschett opened this issue Feb 8, 2023 · 4 comments

Comments

@mariaschett
Copy link
Contributor

Oak Function leverages and relies on Wasm and wasmi to isolate one user request from each other.

We have the following invariants:

  • Oak Functions executes Wasm code triggered by a user request in ephemeral sandboxes.
  • Wasm code can only communicate with Oak Functions through a restricted interface: the Oak Functions ABI. The restricted interface does not allow Wasm code to (i) persistently store data, or (ii) communicate with other Wasm code.
  • wasmi allocates its own and exclusive (linear) memory to every execution of Wasm code.

We need to clarify whether executing two user requests in parallel can lead to contention-based side channel attacks, but for now, Oak Functions only executes a single user request at the time.

I want to state the invariants in a README in oak_functions/wasm and connect to our code, simlar to the invariants for lookup data.

Related: #3449 .

Anything missing @conradgrobler @tiziano88 ?

@conradgrobler
Copy link
Collaborator

conradgrobler commented Feb 8, 2023

A few detail points:

  • Each request has its own ephemeral sandbox (they are never reused)
  • The Wasm sandboxes are ephemeral because the linear memory for each instance is created from a vector that is zero-initialised, and each sandbox is detroyed when the Wasm execution completes
  • We should probably also highlight the point that the linear memory is an isolation boundary because the Wasm execution model means that Wasm code has no ability to access memory outside of the linear memory of its current instance

@mariaschett
Copy link
Contributor Author

Nice!

Maybe also related are our reasons for choosing wasmi as interpreter.

@mariaschett
Copy link
Contributor Author

We should also add the limitation that Oak Functions is currently not able to terminate the execution of a request.

Furthermore, as a precaution, the Oak Functions ABI does not expose any kind of timing functionality to the request's logic.

@mariaschett mariaschett self-assigned this Mar 29, 2023
@mariaschett
Copy link
Contributor Author

Related #3079

@mariaschett mariaschett removed their assignment May 25, 2023
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

2 participants