Stream: git-wasmtime

Topic: wasmtime / PR #3841 Panic on resetting image slots back t...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 16:35):

alexcrichton opened PR #3841 from panic-on-error to main:

This commit updates Drop for MemoryImageSlot to panic instead of
ignoring errors when resetting memory back to a clean slate. On reading
some of this code again for a different change I realized that if an
error happens in reset_with_anon_memory it would be possible,
depending on where another error happened, to leak memory from one image
to another.

For example if clear_and_remain_ready failed its madvise (for
whatever reason) and didn't actually reset any memory, then if Drop for MemoryImageSlot also hit an error trying to remap memory (for whatever
reason), then nothing about memory has changed and when the
MemoryImageSlot is recreated it'll think that it's 0-length when
actually it's a bit larger and may leak data.

I don't think this is a serious problem since we don't know any
situation under which the madvise would fail and/or the resetting with
anonymous memory, but given that these aren't expected to fail I figure
it's best to be a bit more defensive here and/or loud about failures.

<!--

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 (Feb 23 2022 at 16:35):

alexcrichton requested cfallin for a review on PR #3841.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 17:27):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 17:27):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 17:27):

cfallin created PR review comment:

pre-existing but this is unmap_on_drop while a few lines below we say clear_on_drop -- would you mind updating the comment while we're here?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 19:03):

alexcrichton updated PR #3841 from panic-on-error to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2022 at 20:00):

alexcrichton merged PR #3841.


Last updated: Nov 22 2024 at 17:03 UTC