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
RISC-V result should not leave side-effect when trapping. By looking at the spec, we can know that store instruction should check first if the memory address (offset + byte-width) is valid, then perform the memory operation.
Opt level None: Err(error while executing at wasm backtrace:
0: 0x45 - <unknown>!<wasm function 0>
Caused by:
0: memory fault at wasm address 0x10000 in linear memory of size 0x10000
1: wasm trap: out of bounds memory access)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Actual Results
RISC-V leaves memory side-effects when the program traps due to invalid memory address. The PoC code posted above leaves 15 bytes of 255 at the end of the memory. (indices from 65521 to 65535)
Opt level None: Err(error while executing at wasm backtrace:
0: 0x45 - <unknown>!<wasm function 0>
Caused by:
0: memory fault at wasm address 0x10000 in linear memory of size 0x10000
1: wasm trap: out of bounds memory access)
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
Versions and Environment
wasmtime version
commit: 6c51848(current latest, Date: Thu Mar 21 18:24:49 2024 -0700)
However, also checked on v19.0.0
Operating system & architecture: Ubuntu 22.04.3 LTS, Arch: x86_64
QEMU version: qemu-riscv64 version 8.2.1 (v8.2.1)
Extra Info
Works fine on other architectures (x86_64, aarch64, s390x)
RISC-V is not the tier 1 platform, so releasing this bug as public (not a security bug)
The text was updated successfully, but these errors were encountered:
If I'm not mistaken this is the same as #7237, right? We are writing to an unaligned address, crossing a page boundary and one of the pages triggers a fault.
I'm surprised that it works on AArch64 since that one is also supposed to be affected by this.
I'm going to close this in favor of that issue, and I'll also drop a link to WebAssembly/design#1490 which is upstream spec discussion on this topic too.
Test Case
Steps to reproduce
Compare the following executions:
QEMU run options (riscv64) I'm currently using is the following:
Expected Results
RISC-V result should not leave side-effect when trapping. By looking at the spec, we can know that
store
instruction should check first if the memory address (offset + byte-width) is valid, then perform the memory operation.Actual Results
RISC-V leaves memory side-effects when the program traps due to invalid memory address. The PoC code posted above leaves 15 bytes of 255 at the end of the memory. (indices from 65521 to 65535)
Versions and Environment
qemu-riscv64 version 8.2.1 (v8.2.1)
Extra Info
The text was updated successfully, but these errors were encountered: