Files
wasmtime/crates
Alex Crichton 434e35c490 Panic on resetting image slots back to anonymous memory (#3841)
* Panic on resetting image slots back to anonymous memory

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.

* Update a comment
2022-02-23 14:00:06 -06:00
..
2022-02-07 19:16:26 -06:00
2022-02-07 19:16:26 -06:00
2022-02-07 19:16:26 -06:00
2022-02-07 19:16:26 -06:00
2022-02-07 19:16:26 -06:00
2022-02-22 22:30:32 -08:00
2022-02-07 19:16:26 -06:00
2022-02-07 19:16:26 -06:00