Skip to content

Tags: EmbarkStudios/wasmtime

Tags

dev

Toggle dev's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Add guard pages to the front of linear memories (bytecodealliance#2977)

* Add guard pages to the front of linear memories

This commit implements a safety feature for Wasmtime to place guard
pages before the allocation of all linear memories. Guard pages placed
after linear memories are typically present for performance (at least)
because it can help elide bounds checks. Guard pages before a linear
memory, however, are never strictly needed for performance or features.
The intention of a preceding guard page is to help insulate against bugs
in Cranelift or other code generators, such as CVE-2021-32629.

This commit adds a `Config::guard_before_linear_memory` configuration
option, defaulting to `true`, which indicates whether guard pages should
be present both before linear memories as well as afterwards. Guard
regions continue to be controlled by
`{static,dynamic}_memory_guard_size` methods.

The implementation here affects both on-demand allocated memories as
well as the pooling allocator for memories. For on-demand memories this
adjusts the size of the allocation as well as adjusts the calculations
for the base pointer of the wasm memory. For the pooling allocator this
will place a singular extra guard region at the very start of the
allocation for memories. Since linear memories in the pooling allocator
are contiguous every memory already had a preceding guard region in
memory, it was just the previous memory's guard region afterwards. Only
the first memory needed this extra guard.

I've attempted to write some tests to help test all this, but this is
all somewhat tricky to test because the settings are pretty far away
from the actual behavior. I think, though, that the tests added here
should help cover various use cases and help us have confidence in
tweaking the various `Config` settings beyond their defaults.

Note that this also contains a semantic change where
`InstanceLimits::memory_reservation_size` has been removed. Instead this
field is now inferred from the `static_memory_maximum_size` and guard
size settings. This should hopefully remove some duplication in these
settings, canonicalizing on the guard-size/static-size settings as the
way to control memory sizes and virtual reservations.

* Update config docs

* Fix a typo

* Fix benchmark

* Fix wasmtime-runtime tests

* Fix some more tests

* Try to fix uffd failing test

* Review items

* Tweak 32-bit defaults

Makes the pooling allocator a bit more reasonable by default on 32-bit
with these settings.

v0.16.0

Toggle v0.16.0's commit message
Update release notes, wasmtime 0.16, cranelift 0.63.

v0.15.0

Toggle v0.15.0's commit message
Update the env var name in more places.

list

Toggle list's commit message
Update the env var name in more places.

cranelift-v0.62.0

Toggle cranelift-v0.62.0's commit message
Wasmtime 0.15.0 and Cranelift 0.62.0. (bytecodealliance#1398)

cranelift-v0.61.0

Toggle cranelift-v0.61.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Wasmtime 0.13.0 and Cranelift 0.61.0. (bytecodealliance#1398)

This also updates the publishing scripts to work with newly added
and reorganized crates.

cranelift-v0.60.0

Toggle cranelift-v0.60.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Merge pull request bytecodealliance#1344 from fitzgen/cranelift-publi…

…sh-script

Re-add Cranelift publish script

v0.12.0

Toggle v0.12.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Bump to 0.12.0 (bytecodealliance#997)

* Bump to 0.12.0

* Another lockfile update

v0.11.0

Toggle v0.11.0's commit message
Bump version to 0.11.0

v0.10.0

Toggle v0.10.0's commit message
Bump version to 0.10.0