You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, the spec tests were updated to add a new test case asserting that __heap_base and other global exports do not affect memory accesses. WAMR fails this test and I'm trying to understand why.
Run the test with ./test_wamr.sh -s spec -m x86_64 -t classic-interp or something similar.
Your environment
Linux x86_64
WAMR at HEAD
Expected behavior
The upstream patch indicates that engines should ignore the __data_end, __stack_top and __heap_base exports. I'm new to WASM, I could not find anything in the official spec to indicate what (if anything) the engine should do with these.
To me, either the WAMR engine implementation is wrong, or the spec tests are wrong.
Actual behavior
The tests fail with out-of-bounds memory access, because the WAMR loader uses these global module exports to set the heap size.
The text was updated successfully, but these errors were encountered:
@sjamesr thanks for reporting the issue, one of WAMR's goals is to reduce the footprint and the runtime may shrink the linear memory based on the global __data_end, __stack_top and __heap_base. For example, if there is no memory.grow opcode found, runtime may shrink the memory to the position that __heap_base points to, since the libc heap isn't used. That's really important for some embedded and IoT devices whose resources are limited, for example, if not truncated, at lease one page (64KB) of memory will be allocated, but if truncated, it may be shrunk into several KBs and a lot of memory is saved.
The custom-page-sizes proposal wasn't raised yet when WAMR did the optimization. We also pay a lot attention to it, I think we may try to support it once it is ready and is supported by the toolchain.
WAMR fails memory spec test at HEAD
Recently, the spec tests were updated to add a new test case asserting that
__heap_base
and other global exports do not affect memory accesses. WAMR fails this test and I'm trying to understand why.Test case
Apply the following patch and run the spec tests:
Run the test with
./test_wamr.sh -s spec -m x86_64 -t classic-interp
or something similar.Your environment
Expected behavior
The upstream patch indicates that engines should ignore the
__data_end
,__stack_top
and__heap_base
exports. I'm new to WASM, I could not find anything in the official spec to indicate what (if anything) the engine should do with these.To me, either the WAMR engine implementation is wrong, or the spec tests are wrong.
Actual behavior
The tests fail with out-of-bounds memory access, because the WAMR loader uses these global module exports to set the heap size.
The text was updated successfully, but these errors were encountered: