Memory Resetting After Each Execution #3623
Replies: 2 comments 4 replies
-
I see Wasmtime has a zero-ing feature in the runtime (https://docs.wasmtime.dev/security.html#defense-in-depth):
Does WAMR have something like this? |
Beta Was this translation helpful? Give feedback.
-
IIUC, |
Beta Was this translation helpful? Give feedback.
-
We have a use case where we want to reset memory (e.g. memset 0) after each execution of a WASM module. The host platform is Linux. The WASM code is meant to be stateless and would be provided by a client that we do not trust. Our goal is to prevent malicious clients from building up state in memory (not allowed in our use case). I have gone through the documentation, some of the code and played around with the runtime. Here are my thoughts and questions:
I am thinking we would want to create a new execution environment for each execution so we can get a fresh WASM stack? Is the stack memset to 0 during initialization? Are there safeguards in place to prevent overflow attacks?
Since the heap is tied to a module instance, I am assuming we would need to reset memory on it manually. My first attempt was to use
Alloc_With_Pool
so the native app can control where the global heap memory is allocated. However, the mallocs done in the WASM code end up getting memory addresses (converted to native pointers) outside of this pool. My guess is that because I am running this on Linux, the memory is not allocated from the global heap:Is there a way to get a handle on the dynamic memory allocated by the WASM module in the native context in this case? Or should we try to disallow dynamic memory allocations altogether.
There are a few more questions, but maybe we can start with this first!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions