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

feat(wasi) Add the “floating” WasiVersion::Latest version. #1029

Merged
merged 4 commits into from
Dec 4, 2019

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Dec 2, 2019

In addition to Snapshot0 and Snapshot1, I believe it is an
interesting API to provide the Latest version, so that the user can
write:

generate_import_object_for_version(WasiVersion::Latest,);

This is a way to ensure that modules will run only if they come with
the latest WASI version (in case of security issues for instance), by
just updating the runtime.

Note that it can be dangerous if not used carefully, but we assume the
user knows what it does by sticking on a specific “floating” version.

Also note that the Latest version is never returned by any API. It
is provided only by the user.

In addition to `Snapshot0` and `Snapshot1`, I believe it is an
interesting API to provide the `Latest` version, so that the user can
write:

```rust
generate_import_object_for_version(WasiVersion::Latest, …);
```

This is a way to ensure that modules will run only if they come with
the latest WASI version (in case of security issues for instance), by
just updating the runtime.

Note that it can be dangerous if not used carefully, but we assume the
user knows what it does by sticking on a specific “floating” version.

Also note that the `Latest` version is never returned by any API. It
is provided only by the user.
@Hywan Hywan added 🎉 enhancement New feature! 📦 lib-wasi About wasmer-wasi labels Dec 2, 2019
@Hywan Hywan requested a review from MarkMcCaskey as a code owner December 2, 2019 14:54
@Hywan Hywan changed the title feat(wasi) Add the “volatile” WasiVersion::Latest version. feat(wasi) Add the “floating” WasiVersion::Latest version. Dec 2, 2019
@Hywan
Copy link
Contributor Author

Hywan commented Dec 2, 2019

bors try

Copy link
Contributor

@MarkMcCaskey MarkMcCaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me! It'd be good to add what you said in this PR here to the comments, it'd be nice if we could assert that it's never returned too, like an attribute #[user_supplied] -- I doubt it's possible or worth the effort if we have to make it now, but it'd be nice

bors bot added a commit that referenced this pull request Dec 3, 2019
@bors
Copy link
Contributor

bors bot commented Dec 3, 2019

try

Build succeeded

@Hywan
Copy link
Contributor Author

Hywan commented Dec 4, 2019

it'd be nice if we could assert that it's never returned too, like an attribute #[user_supplied] -- I doubt it's possible or worth the effort if we have to make it now, but it'd be nice

It would be nice yeah, but I didn't find an easy to do that… Let skip that part for the moment.

@Hywan
Copy link
Contributor Author

Hywan commented Dec 4, 2019

bors r+

bors bot added a commit that referenced this pull request Dec 4, 2019
1029: feat(wasi) Add the “floating” `WasiVersion::Latest` version. r=Hywan a=Hywan

In addition to `Snapshot0` and `Snapshot1`, I believe it is an
interesting API to provide the `Latest` version, so that the user can
write:

```rust
generate_import_object_for_version(WasiVersion::Latest, …);
```

This is a way to ensure that modules will run only if they come with
the latest WASI version (in case of security issues for instance), by
just updating the runtime.

Note that it can be dangerous if not used carefully, but we assume the
user knows what it does by sticking on a specific “floating” version.

Also note that the `Latest` version is never returned by any API. It
is provided only by the user.

Co-authored-by: Ivan Enderlin <[email protected]>
@bors
Copy link
Contributor

bors bot commented Dec 4, 2019

Build succeeded

@bors bors bot merged commit 9d42af8 into wasmerio:master Dec 4, 2019
bors bot added a commit to wasmerio/wasmer-go that referenced this pull request Jan 7, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan

Fix #90.
Fix #77.

⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too).

This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions.

After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type.

Finally, this patch updates the tests to test this new API. And it works like a charm 👌.

Co-authored-by: Ivan Enderlin <[email protected]>
bors bot added a commit to wasmerio/wasmer-go that referenced this pull request Jan 8, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan

Fix #90.
Fix #77.

⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too).

This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions.

After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type.

Finally, this patch updates the tests to test this new API. And it works like a charm 👌.

Co-authored-by: Ivan Enderlin <[email protected]>
bors bot added a commit to wasmerio/wasmer-go that referenced this pull request Jan 15, 2020
92: feat(wasi) Support `WasiGetVersion` & other `*ForVersion` WASI API r=Hywan a=Hywan

Fix #90.
Fix #77.

⚠️ Depends on wasmerio/wasmer#1028, wasmerio/wasmer#1029, and wasmerio/wasmer#1030. They must be merged before merging this PR! Marking this PR as a draft to be sure (the shared libraries must be updated too).

This patch updates `bridge.go` and `wasmer.h` to support the new `wasmer_wasi_generate_import_object_for_version` and `wasmer_wasi_get_version` functions.

After that, this patch updates `wasi.go` to implement the new `NewDefaultWasiImportObjectForVersion`, `NewWasiImportObjectForVersion` and the `WasiGetVersion` functions. In addition to that, we create a new `WasiVersion` type.

Finally, this patch updates the tests to test this new API. And it works like a charm 👌.

Co-authored-by: Ivan Enderlin <[email protected]>
@Hywan Hywan mentioned this pull request Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-wasi About wasmer-wasi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants