-
Notifications
You must be signed in to change notification settings - Fork 724
Description
Thanks for filing a bug or defect report! Please fill out the TODOs below.
Subject of the issue
In os_mmap() in sgx_platform.c memory is allocated from sgx reserved memory. There is no guarantee that the memory will be zero'd out. In particular, this can be a problem if multiple execution environments are created (where reserved memory is allocated and then deallocated multiple times).
Test case
Not relevant.
Your environment
- Ubuntu 24.04
- WAMR 2.4.1 on SGX
Steps to reproduce
Create and destroy an execution environment repeatedly. The memory returned from SGX will have the data from the previous execution environment (it is not reset).
Expected behavior
Each invocation should be independent.
Actual behavior
Tell us what happens instead
Extra Info
A fairly simple memset on allocation solves the problem. A slightly more performant version which assumes the initial allocation is zero'd out memset's the memory when it is returned to the sgx reserved memory pool in munump.