-
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
make Module::deserialize's version check optional via Config #2945
Conversation
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "cranelift", "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 |
@@ -329,7 +329,7 @@ impl<'a> SerializedModule<'a> { | |||
Ok(bytes) | |||
} | |||
|
|||
pub fn from_bytes(bytes: &[u8]) -> Result<Self> { | |||
pub fn from_bytes(bytes: &[u8], check_version: bool) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check_version = false
version should be unsafe as it is much easier to get wasmtime to interpret caches from a different wasmtime version to be interpreted incorrectly in such a way that you get UB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, the deserialize
function is already unsafe
, so this should just add caveat there to the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me! I was thinking as well though that we'd just omit the version header entirely on serialization too?
@@ -329,7 +329,7 @@ impl<'a> SerializedModule<'a> { | |||
Ok(bytes) | |||
} | |||
|
|||
pub fn from_bytes(bytes: &[u8]) -> Result<Self> { | |||
pub fn from_bytes(bytes: &[u8], check_version: bool) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, the deserialize
function is already unsafe
, so this should just add caveat there to the documentation.
A SerializedModule contains the CARGO_PKG_VERSION string, which is checked for equality when loading. This is a great guard-rail but some users may want to disable this check (e.g. so they can implement their own versioning scheme)
9d15c09
to
c270b39
Compare
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Based on #2897 - draft until that PR lands.
A SerializedModule contains the CARGO_PKG_VERSION string, which is
checked for equality when loading. This is a great guard-rail but
some users may want to disable this check (e.g. so they can implement
their own versioning scheme)