-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove unsoundness of widening store borrows #11481
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
Remove unsoundness of widening store borrows #11481
Conversation
| ); | ||
| store.on_fiber(|store| self.instantiate_impl(store)).await? | ||
| pub async fn instantiate_async(&self, store: impl AsContextMut<Data = T>) -> Result<Instance> { | ||
| self._instantiate(store).await |
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.
Why do we not need an assert!(store.0.async_support()) here anymore?
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.
A good question! That's part of the previous commits and Nick was also curious here, with some rationale in my response over there
fitzgen
left a comment
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.
Nice!
This commit removes preexisting unsoundness in Wasmtime where a `&mut StoreOpaque` borrow was "widened" into encompassing the limiter on the `T` in `StoreInner<T>`, for example, by using the self-pointer located in an instance or the store. This fix is done by threading `&mut StoreOpaque` as a parameter separately from a `StoreResourceLimiter`. This means that various callers now take a new `Option<&mut StoreResourceLimiter<'_>>` parameter in various locations. Closes bytecodealliance#11409
20ee87b to
1288134
Compare
* Remove unsoundness of widening store borrows This commit removes preexisting unsoundness in Wasmtime where a `&mut StoreOpaque` borrow was "widened" into encompassing the limiter on the `T` in `StoreInner<T>`, for example, by using the self-pointer located in an instance or the store. This fix is done by threading `&mut StoreOpaque` as a parameter separately from a `StoreResourceLimiter`. This means that various callers now take a new `Option<&mut StoreResourceLimiter<'_>>` parameter in various locations. Closes bytecodealliance#11409 * Fix gc-less build
This commit removes preexisting unsoundness in Wasmtime where a
&mut StoreOpaqueborrow was "widened" into encompassing the limiter onthe
TinStoreInner<T>, for example, by using the self-pointerlocated in an instance or the store. This fix is done by threading
&mut StoreOpaqueas a parameter separately from aStoreResourceLimiter. This means that various callers now take a newOption<&mut StoreResourceLimiter<'_>>parameter in various locations.Closes #11409