In Fig. 4 of Everything old is new Again, it is suggested that the memory layout in Linear Memory varies depending on the compiler.
When looking at the Documentation it seems more like the operand stack is not even in the linear Memory and a the storage layout is uniformly defined.
Which is the Case?
Is there documentation for which compiler uses which layout?
Is WebAssembly with different Storage Layouts still deterministic in case of a buffer overflow?
The operand stack is completely separate from the linear memory and the wasm engine will ensure it isn't tampered with. The stack that figure is referring to is the emulated stack which contains values that need to be stored in the linear memory. For example because they got their address taken, or are too large to be placed on the operand stack or in locals. It doesn't contain return addresses and the like. As far as the wasm engine is concerned this emulated stack is just regular memory.
Is WebAssembly with different Storage Layouts still deterministic in case of a buffer overflow?
Yes
Lasse Krähner has marked this topic as resolved.
bjorn3 said:
Is WebAssembly with different Storage Layouts still deterministic in case of a buffer overflow?
Yes
do you have literature/documentation for this?
As far as the wasm engine is concerned, there is no such thing as a buffer overflow. It has no knowledge at all about how the wasm module uses it's linear memory, so it can't do anything like optimizing based on UB (wasm has no UB)
@Lasse I think the canonical citation for that would be the determism of Wasm overall (in addition to what bjorn3 said -- what happens inside is opaque, but each step is well-defined)
think of it like a CPU emulator stepping through an exploit sequence -- every instruction is still well-defined as the exploit happens "inside the machine"
Last updated: Nov 22 2024 at 16:03 UTC