Stream: git-wasmtime

Topic: wasmtime / PR #3265 Don't copy executable code into a `Co...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 15:35):

alexcrichton opened PR #3265 from no-copy-code-memory to main:

This commit moves a copy from compiled artifacts into a CodeMemory. In
general this commit drastically changes the meaning of a CodeMemory.
Previously it was an iteratively-pushed-on structure that would
accumulate executable code over time. Afterwards, however, it's a
manager for an MmapVec which updates the permissions on text section
to ensure that the pages are executable.

By taking ownership of an MmapVec within a CodeMemory there's no
need to copy any data around, which means that the .text section in
the ELF image produced by Wasmtime is usable as-is after placement in
memory and relocations have been resolved. This moves Wasmtime one step
closer to being able to directly use a module after it's mmap'd into
memory, optimizing when a module is loaded.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 15:36):

alexcrichton edited PR #3265 from no-copy-code-memory to main:

This commit moves a copy from compiled artifacts into a CodeMemory. In
general this commit drastically changes the meaning of a CodeMemory.
Previously it was an iteratively-pushed-on structure that would
accumulate executable code over time. Afterwards, however, it's a
manager for an MmapVec which updates the permissions on text section
to ensure that the pages are executable.

By taking ownership of an MmapVec within a CodeMemory there's no
need to copy any data around, which means that the .text section in
the ELF image produced by Wasmtime is usable as-is after placement in
memory and relocations have been resolved. This moves Wasmtime one step
closer to being able to directly use a module after it's mmap'd into
memory, optimizing when a module is loaded.

cc #3230

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 15:37):

alexcrichton requested peterhuene for a review on PR #3265.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 16:04):

alexcrichton updated PR #3265 from no-copy-code-memory to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 16:17):

alexcrichton updated PR #3265 from no-copy-code-memory to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 16:18):

alexcrichton updated PR #3265 from no-copy-code-memory to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:23):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:23):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:23):

peterhuene created PR review comment:

                .with_context(|| "failed to parse internal compilation artifact")?,

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:23):

peterhuene created PR review comment:

    /// `publish` method is used to actually make the memory executable.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:38):

alexcrichton updated PR #3265 from no-copy-code-memory to main.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 30 2021 at 18:38):

alexcrichton merged PR #3265.


Last updated: Dec 23 2024 at 12:05 UTC