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

Update memfd image construction to avoid excessively large images #3819

Merged

Commits on Feb 16, 2022

  1. Update memfd image construction to avoid excessively large images

    Previously memfd-based image construction had a hard limit of a 1GB
    memory image but this mean that tiny wasm modules could allocate up to
    1GB of memory which became a bit excessive especially in terms of memory
    usage during fuzzing. To fix this the conversion to a static memory
    image has been updated to first do a conversion to paged memory
    initialization, which is sparse, followed by a second conversion to
    static memory initialization.
    
    The sparse construction for the paged step should make it such that the
    upper/lower bounds of the initialization image are easily computed, and
    then afterwards this limit can be checked against some heuristics to
    determine if we're willing to commit to building up a whole static image
    for that module. The heuristics have been tweaked from "must be less
    than 1GB" to one of two conditions must be true:
    
    * Either the total memory image size is at most twice the size of the
      original paged data itself.
    
    * Otherwise the memory image size must be smaller than a reasonable
      threshold, currently 1MB.
    
    We'll likely need to tweak this over time and it's still possible to
    cause a lot of extra memory consumption, but for now this should be
    enough to appease the fuzzers.
    
    Closes bytecodealliance#3815
    alexcrichton committed Feb 16, 2022
    Configuration menu
    Copy the full SHA
    8d373bc View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2022

  1. Review comments

    alexcrichton committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    7c296ab View commit details
    Browse the repository at this point in the history