-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix a panic using tables with the wrong type #8283
Merged
alexcrichton
merged 1 commit into
bytecodealliance:main
from
alexcrichton:fix-panic-with-dropped-segment
Apr 2, 2024
Merged
Fix a panic using tables with the wrong type #8283
alexcrichton
merged 1 commit into
bytecodealliance:main
from
alexcrichton:fix-panic-with-dropped-segment
Apr 2, 2024
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
This commit fixes an accidental issue introduced in bytecodealliance#8018 where using an element segment which had been dropped with an `externref` table would cause a panic. The panic happened due to an assertion that tables are being used with the right type of item and that was being mismatched. The underlying issue was that dropped element segments are modeled as an empty element segment but the empty element segment was using the "functions" encoding as opposed to the "expressions" encoding. This meant that code later assumed that due to the use of functions the table must be a table-of-functions, but this was not correct for externref-based tables. The fix in this commit is to instead model the encoding as an "expressions" list which means that the table type is dispatched on to call the appropriate initializer. There is no memory safety issue with this mistake as the assertion was specifically targetted at preventing memory safety. This does, however, enable any WebAssembly module to panic a host. Closes bytecodealliance#8281
As I noted on the issue and per our policy this is actually a security vulnerability. I'll work on getting a 19.0.1 out today with this fix. |
fitzgen
approved these changes
Apr 2, 2024
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 2, 2024
This commit fixes an accidental issue introduced in bytecodealliance#8018 where using an element segment which had been dropped with an `externref` table would cause a panic. The panic happened due to an assertion that tables are being used with the right type of item and that was being mismatched. The underlying issue was that dropped element segments are modeled as an empty element segment but the empty element segment was using the "functions" encoding as opposed to the "expressions" encoding. This meant that code later assumed that due to the use of functions the table must be a table-of-functions, but this was not correct for externref-based tables. The fix in this commit is to instead model the encoding as an "expressions" list which means that the table type is dispatched on to call the appropriate initializer. There is no memory safety issue with this mistake as the assertion was specifically targetted at preventing memory safety. This does, however, enable any WebAssembly module to panic a host. Closes bytecodealliance#8281
alexcrichton
added a commit
that referenced
this pull request
Apr 2, 2024
This commit fixes an accidental issue introduced in #8018 where using an element segment which had been dropped with an `externref` table would cause a panic. The panic happened due to an assertion that tables are being used with the right type of item and that was being mismatched. The underlying issue was that dropped element segments are modeled as an empty element segment but the empty element segment was using the "functions" encoding as opposed to the "expressions" encoding. This meant that code later assumed that due to the use of functions the table must be a table-of-functions, but this was not correct for externref-based tables. The fix in this commit is to instead model the encoding as an "expressions" list which means that the table type is dispatched on to call the appropriate initializer. There is no memory safety issue with this mistake as the assertion was specifically targetted at preventing memory safety. This does, however, enable any WebAssembly module to panic a host. Closes #8281
gitlab-dfinity
pushed a commit
to dfinity/ic
that referenced
this pull request
Apr 15, 2024
Chore: Upgrade wasmtime to v19.0.1 Upgrading wasmtime to v19.0.1 https://github.com/bytecodealliance/wasmtime/blob/main/RELEASES.md#1900 plus this change bytecodealliance/wasmtime#8283 GHSA-75hq-h6g9-h4q5 We can upgrade other crates, such as wasmparser and wasm-encoder at a later time. Currently it seems that a lot of new types got introduced there, and it may be a good idea to give these changes a moment to settle. See merge request dfinity-lab/public/ic!18590
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
This commit fixes an accidental issue introduced in #8018 where using an element segment which had been dropped with an
externref
table would cause a panic. The panic happened due to an assertion that tables are being used with the right type of item and that was being mismatched. The underlying issue was that dropped element segments are modeled as an empty element segment but the empty element segment was using the "functions" encoding as opposed to the "expressions" encoding. This meant that code later assumed that due to the use of functions the table must be a table-of-functions, but this was not correct for externref-based tables.The fix in this commit is to instead model the encoding as an "expressions" list which means that the table type is dispatched on to call the appropriate initializer.
There is no memory safety issue with this mistake as the assertion was specifically targetted at preventing memory safety. This does, however, enable any WebAssembly module to panic a host.
Closes #8281