-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-ch89-5g45-qwc7
* Fix miscompile from functions mutating `VMContext` This commit fixes a miscompilation in Wasmtime on LLVM 16 where methods on `Instance` which mutated the state of the internal `VMContext` were optimized to not actually mutate the state. The root cause of this issue is a change in LLVM which takes advantage of `noalias readonly` pointers which is how `&self` methods are translated. This means that `Instance` methods which take `&self` but actually mutate the `VMContext` end up being undefined behavior from LLVM's point of view, meaning that the writes are candidate for removal. The fix applied here is intended to be a temporary one while a more formal fix, ideally backed by `cargo miri` verification, is implemented on `main`. The fix here is to change the return value of `vmctx_plus_offset` to return `*const T` instead of `*mut T`. This caused lots of portions of the runtime code to stop compiling because mutations were indeed happening. To cover these a new `vmctx_plus_offset_mut` method was added which notably takes `&mut self` instead of `&self`. This forced all callers which may mutate to reflect the `&mut self` requirement, propagating that outwards. This fixes the miscompilation with LLVM 16 in the immediate future and should be at least a meager line of defense against issues like this in the future. This is not a long-term fix, though, since `cargo miri` still does not like what's being done in `Instance` and with `VMContext`. That fix is likely to be more invasive, though, so it's being deferred to later. * Update release notes * Fix release date
- Loading branch information
1 parent
b6bc33d
commit 4b9ce0e
Showing
6 changed files
with
95 additions
and
82 deletions.
There are no files selected for viewing
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 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 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
Oops, something went wrong.