Merge pull request from GHSA-wh6w-3828-g9qf
* Unconditionally use `MemoryImageSlot` This commit removes the internal branching within the pooling instance allocator to sometimes use a `MemoryImageSlot` and sometimes now. Instead this is now unconditionally used in all situations on all platforms. This fixes an issue where the state of a slot could get corrupted if modules being instantiated switched from having images to not having an image or vice versa. The bulk of this commit is the removal of the `memory-init-cow` compile-time feature in addition to adding Windows support to the `cow.rs` file. * Fix compile on Unix * Add a stricter assertion for static memory bounds Double-check that when a memory is allocated the configuration required is satisfied by the pooling allocator.
This commit is contained in:
@@ -62,7 +62,6 @@ default = [
|
||||
'parallel-compilation',
|
||||
'cranelift',
|
||||
'pooling-allocator',
|
||||
'memory-init-cow',
|
||||
'vtune',
|
||||
]
|
||||
|
||||
@@ -104,13 +103,6 @@ all-arch = ["wasmtime-cranelift?/all-arch"]
|
||||
# need portable signal handling.
|
||||
posix-signals-on-macos = ["wasmtime-runtime/posix-signals-on-macos"]
|
||||
|
||||
# Enables, on supported platforms, the usage of copy-on-write initialization of
|
||||
# compatible linear memories. For more information see the documentation of
|
||||
# `Config::memory_init_cow`.
|
||||
#
|
||||
# Enabling this feature has no effect on unsupported platforms.
|
||||
memory-init-cow = ["wasmtime-runtime/memory-init-cow"]
|
||||
|
||||
# Enables in-progress support for the component model. Note that this feature is
|
||||
# in-progress, buggy, and incomplete. This is primarily here for internal
|
||||
# testing purposes.
|
||||
|
||||
@@ -1340,8 +1340,6 @@ impl Config {
|
||||
///
|
||||
/// [`Module::deserialize_file`]: crate::Module::deserialize_file
|
||||
/// [`Module`]: crate::Module
|
||||
#[cfg(feature = "memory-init-cow")]
|
||||
#[cfg_attr(nightlydoc, doc(cfg(feature = "memory-init-cow")))]
|
||||
pub fn memory_init_cow(&mut self, enable: bool) -> &mut Self {
|
||||
self.memory_init_cow = enable;
|
||||
self
|
||||
@@ -1367,8 +1365,6 @@ impl Config {
|
||||
/// on.
|
||||
///
|
||||
/// This option is disabled by default.
|
||||
#[cfg(feature = "memory-init-cow")]
|
||||
#[cfg_attr(nightlydoc, doc(cfg(feature = "memory-init-cow")))]
|
||||
pub fn force_memory_init_memfd(&mut self, enable: bool) -> &mut Self {
|
||||
self.force_memory_init_memfd = enable;
|
||||
self
|
||||
@@ -1409,8 +1405,6 @@ impl Config {
|
||||
/// as the maximum module initial memory content size.
|
||||
///
|
||||
/// By default this value is 16 MiB.
|
||||
#[cfg(feature = "memory-init-cow")]
|
||||
#[cfg_attr(nightlydoc, doc(cfg(feature = "memory-init-cow")))]
|
||||
pub fn memory_guaranteed_dense_image_size(&mut self, size_in_bytes: u64) -> &mut Self {
|
||||
self.memory_guaranteed_dense_image_size = size_in_bytes;
|
||||
self
|
||||
@@ -1683,11 +1677,7 @@ impl PoolingAllocationConfig {
|
||||
/// Configures the method by which slots in the pooling allocator are
|
||||
/// allocated to instances
|
||||
///
|
||||
/// This defaults to [`PoolingAllocationStrategy::ReuseAffinity`] when the
|
||||
/// `memory-init-cow` feature of Wasmtime is enabled, which is enabled by
|
||||
/// default. Otherwise it defaults to
|
||||
/// [`PoolingAllocationStrategy::NextAvailable`] Otherwise it defaults to
|
||||
/// [`PoolingAllocationStrategy::NextAvailable`].
|
||||
/// This defaults to [`PoolingAllocationStrategy::ReuseAffinity`] .
|
||||
pub fn strategy(&mut self, strategy: PoolingAllocationStrategy) -> &mut Self {
|
||||
self.config.strategy = strategy;
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user