-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bring back Module::deserialize
#2858
Merged
alexcrichton
merged 3 commits into
bytecodealliance:main
from
alexcrichton:bring-back-deserialize
Apr 27, 2021
Merged
Bring back Module::deserialize
#2858
alexcrichton
merged 3 commits into
bytecodealliance:main
from
alexcrichton:bring-back-deserialize
Apr 27, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I thought I was being clever suggesting that `Module::deserialize` was removed from bytecodealliance#2791 by funneling all module constructors into `Module::new`. As our studious fuzzers have found, though, this means that `Module::new` is not safe currently to pass arbitrary user-defined input into. Now one might pretty reasonable expect to be able to do that, however, being a WebAssembly engine and all. This PR as a result separates the `deserialize` part of `Module::new` back into `Module::deserialize`. This means that binary blobs created with `Module::serialize` and `Engine::precompile_module` will need to be passed to `Module::deserialize` to "rehydrate" them back into a `Module`. This restores the property that it should be safe to pass arbitrary input to `Module::new` since it's always expected to be a wasm module. This also means that fuzzing will no longer attempt to fuzz `Module::deserialize` which isn't something we want to do anyway.
github-actions
bot
added
wasmtime:api
Related to the API of the `wasmtime` crate itself
wasmtime:c-api
Issues pertaining to the C API.
labels
Apr 26, 2021
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:c-api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
fitzgen
reviewed
Apr 26, 2021
peterhuene
approved these changes
Apr 26, 2021
peterhuene
reviewed
Apr 26, 2021
mchesser
pushed a commit
to mchesser/wasmtime
that referenced
this pull request
May 24, 2021
* Bring back `Module::deserialize` I thought I was being clever suggesting that `Module::deserialize` was removed from bytecodealliance#2791 by funneling all module constructors into `Module::new`. As our studious fuzzers have found, though, this means that `Module::new` is not safe currently to pass arbitrary user-defined input into. Now one might pretty reasonable expect to be able to do that, however, being a WebAssembly engine and all. This PR as a result separates the `deserialize` part of `Module::new` back into `Module::deserialize`. This means that binary blobs created with `Module::serialize` and `Engine::precompile_module` will need to be passed to `Module::deserialize` to "rehydrate" them back into a `Module`. This restores the property that it should be safe to pass arbitrary input to `Module::new` since it's always expected to be a wasm module. This also means that fuzzing will no longer attempt to fuzz `Module::deserialize` which isn't something we want to do anyway. * Fix an example * Mark `Module::deserialize` as `unsafe`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
wasmtime:api
Related to the API of the `wasmtime` crate itself
wasmtime:c-api
Issues pertaining to the C API.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I thought I was being clever suggesting that
Module::deserialize
wasremoved from #2791 by funneling all module constructors into
Module::new
. As our studious fuzzers have found, though, this meansthat
Module::new
is not safe currently to pass arbitrary user-definedinput into. Now one might pretty reasonable expect to be able to do
that, however, being a WebAssembly engine and all. This PR as a result
separates the
deserialize
part ofModule::new
back intoModule::deserialize
.This means that binary blobs created with
Module::serialize
andEngine::precompile_module
will need to be passed toModule::deserialize
to "rehydrate" them back into aModule
. Thisrestores the property that it should be safe to pass arbitrary input to
Module::new
since it's always expected to be a wasm module. This alsomeans that fuzzing will no longer attempt to fuzz
Module::deserialize
which isn't something we want to do anyway.