Skip to content
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

Wasmtime: Implement the custom-page-sizes proposal #8763

Merged
merged 19 commits into from
Jun 12, 2024

Commits on Jun 12, 2024

  1. Wasmtime: Implement the custom-page-sizes proposal

    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.
    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    4d6385b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c1e57a9 View commit details
    Browse the repository at this point in the history
  3. Remove debug logging

    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    1657a78 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    25737d9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a48835d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3b3d883 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6506f27 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f3c5a01 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ff8630b View commit details
    Browse the repository at this point in the history
  10. Better handle overflows when rounding up to the host page size

    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).
    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    3ce470c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    83a5d78 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    621f29d View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    c9de801 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    30ed095 View commit details
    Browse the repository at this point in the history
  15. Avoid actually trying to allocate the whole address space in the `mas…

    …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.
    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    0b2ed81 View commit details
    Browse the repository at this point in the history
  16. prtest:full

    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    6fe8f3e View commit details
    Browse the repository at this point in the history
  17. Revert "Avoid actually trying to allocate the whole address space in …

    …the `massive_64_bit_still_limited` test"
    
    This reverts commit ccfa34a.
    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    67c3506 View commit details
    Browse the repository at this point in the history
  18. miri: don't attempt to allocate more than 4GiB of memory

    It seems that rather than returning a null pointer from `std::alloc::alloc`,
    miri will sometimes choose to simply crash the whole program.
    fitzgen committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    68ad4ca View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    3732ec8 View commit details
    Browse the repository at this point in the history