Wasmtime: Implement the custom-page-sizes proposal#8763
Conversation
These were written while implementing the proposal in Wasmtime: bytecodealliance/wasmtime#8763
69cfb13 to
8f3bd6b
Compare
alexcrichton
left a comment
There was a problem hiding this comment.
This looks great to me, thanks!
Subscribe to Label Actioncc @fitzgen DetailsThis issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:x64", "cranelift:wasm", "fuzzing", "wasmtime:api", "wasmtime:config"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
DetailsTo modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
|
I believe all review feedback has been addressed at this point. |
| /// [`PoolingAllocationConfig::linear_memory_keep_resident`] except that it | ||
| /// is applicable to tables instead. | ||
| pub fn table_keep_resident(&mut self, size: usize) -> &mut Self { | ||
| let size = round_up_to_pages(size as u64) as usize; |
There was a problem hiding this comment.
This change is fine by me, but this might reveal some fuzz bugs after this lands as we trip various assertions that previously assumed things were page aligned. I'm not sure how many of these options we frob during fuzzing though...
In any case it's fine to fix them as they arise, just wanted to give a heads up.
This comment was marked as resolved.
This comment was marked as resolved.
This commit adds support for the custom-page-sizes proposal to Wasmtime: https://github.com/WebAssembly/custom-page-sizes I've migrated, fixed some bugs within, and extended the `*.wast` tests for this proposal from the `wasm-tools` repository. I intend to upstream them into the proposal shortly. There is a new `wasmtime::Config::wasm_custom_page_sizes_proposal` method to enable or disable the proposal. It is disabled by default. Our fuzzing config has been updated to turn this feature on/off as dictated by the arbitrary input given to us from the fuzzer. Additionally, there were getting to be so many constructors for `wasmtime::MemoryType` that I added a builder rather than add yet another constructor. In general, we store the `log2(page_size)` rather than the page size directly. This helps cut down on invalid states and properties we need to assert. I've also intentionally written this code such that supporting any power of two page size (rather than just the exact values `1` and `65536` that are currently valid) will essentially just involve updating `wasmparser`'s validation and removing some debug asserts in Wasmtime.
Propagate errors instead of returning a value that is not actually a rounded up version of the input. Delay rounding up various config sizes until runtime instead of eagerly doing it at config time (which isn't even guaranteed to work, so we already had to have a backup plan to round up at runtime, since we might be cross-compiling wasm or not have the runtime feature enabled).
…sive_64_bit_still_limited` test The point of the test is to ensure that we hit the limiter, so just cancel the allocation from the limiter, and otherwise avoid MIRI attempting to allocate a bunch of memory after we hit the limiter.
…the `massive_64_bit_still_limited` test" This reverts commit ccfa34a.
It seems that rather than returning a null pointer from `std::alloc::alloc`, miri will sometimes choose to simply crash the whole program.
0efb7f4 to
3732ec8
Compare
| /// A linear memory | ||
| /// A linear memory's backing storage. | ||
| /// | ||
| /// This does not a full Wasm linear memory, as it may |
There was a problem hiding this comment.
Thanks for catching this!
This commit adds support for the custom-page-sizes proposal to Wasmtime: https://github.com/WebAssembly/custom-page-sizes
I've migrated, fixed some bugs within, and extended the
*.wasttests for this proposal from thewasm-toolsrepository. I intend to upstream them into the proposal shortly.There is a new
wasmtime::Config::wasm_custom_page_sizes_proposalmethod to enable or disable the proposal. It is disabled by default.Our fuzzing config has been updated to turn this feature on/off as dictated by the arbitrary input given to us from the fuzzer.
Additionally, there were getting to be so many constructors for
wasmtime::MemoryTypethat I added a builder rather than add yet another constructor.In general, we store the
log2(page_size)rather than the page size directly. This helps cut down on invalid states and properties we need to assert.I've also intentionally written this code such that supporting any power of two page size (rather than just the exact values
1and65536that are currently valid) will essentially just involve updatingwasmparser's validation and removing some debug asserts in Wasmtime.