| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
per-memory (#2507)
The PR updates the bulk memory operations (memory.fill, memory.copy,
table.fill, etc.) to support 64-bit addresses and counts. Previously these functions
only took u32's, even with memory64 enabled. (#2506)
This PR also allows "software-bounds-checked" memories and "guard-page-checked"
memories to coexist in the same module. It creates two versions of every memory
operation: an unrestricted version (that works with any memory) and a _default32
version (for memories with default page size and i32 indexing). (#2507)
#2506 and #2507 have been squashed together to avoid a performance regression.
This is a stepping stone to supporting custom-page-sizes (which will need to be
software-bounds-checked) (#2508).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Decode just enough of the component binary format to recognize when the
input is a component, and issue a dedicated error message for it.
Before:
0000008: error: bad wasm file version: 0x1000d (expected 0x1)
After:
0000008: error: wasm components are not yet supported in this tool
|
|
|
|
|
|
| |
macos-12 is no longer available, this changes it to macos-13 (latest
available x64 macos)
macos-14 is changed to macos-latest (arm64)
|
|
|
| |
Add `Installation` section to readme to help the next person ❤️
|
|
|
| |
Continuation of #2470
|
|
|
|
| |
This pull request implements EHv4. Binary is mostly untested until
interp is working.
|
| |
|
|
|
|
|
|
| |
Define the fsgabase capability lookup to
HWCAP2_FSGSBASE as per
https://www.kernel.org/doc/html/latest/arch/x86/x86_64/fsgs.html#fsgsbase-instructions-enablement
|
| |
|
| |
|
|
|
|
| |
This adds support in the binary/text parsers and writers,
the validator and interpreter, and objdump (but not wasm2c).
|
| |
|
|
|
|
|
|
|
| |
Characters `"` and `\` which have special meaning in data
representations are not escaped by wasm-decompile and are passed to
output as is.
This PR fixes such incorrect behavior.
All tests still pass (although no cases are added).
|
| |
|
|
|
|
|
| |
The memory64 `table.wast` test has started to depend on
function-references and gc (which WABT doesn't support yet), so vendor
an older version of the test.
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
(`TokenType::Exn` already exists for some reason)
|
|
|
|
|
| |
`exnref`'s opcode is -0x17:
https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md#exnref
|
|
|
|
| |
have changed
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Previously, the parser would return result::Error, but would not
populate an error message.
|
|
|
| |
local decl count != local count
|
|
|
|
|
|
|
| |
It is UB to read local variables after a call to `setjmp` returns, if
those variables have been modified between `setjmp` and `longjmp`,
unless they're marked as `volatile`. This marks them as `volatile`.
Closes #2469
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes the value stack size of the catch handler. There were two
(related) issues here:
- The previous code used `func_->locals.size()` as soon as the function
was available, but it hadn't processed the function's locals yet, so it
was always empty. (This might not matter in practice, as it's only used
by the "function-wide catch handler", which just rethrows.)
- The previous code didn't take the function's locals into account when
computing the value stack height (relative to the function frame) for a
try-catch block. So, it would drop the locals when catching an
exception.
Closes #2476
(Split from #2470 )
|
|
|
|
|
| |
Same issue as #2471 but for `call_ref`.
We don't believe there's a prior issue for this.
|
|
|
|
|
|
| |
Closes #2436
Fixes #2310
Fixes #2311
Fixes #2431
|
|
|
|
| |
Fixes #2453 in a bit of a silly way. (Conveniently, we already have
tests for this, but nobody noticed they were broken.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clang 17(?) tightened UBSAN checks, so that you now get this:
```
- test/wasm2c/spec/call_indirect.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,3 @@
+out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12: runtime error: call to function w2c_call__indirect__0__wasm_f0 through pointer to incorrect function type 'unsigned int (*)(void *)'
+/home/runner/work/wabt/wabt/out/test/wasm2c/spec/call_indirect/call_indirect.0.c:1925: note: w2c_call__indirect__0__wasm_f0 defined here
+SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +0,0 @@
-134/134 tests passed.
```
This happens because emitted functions use a typed module instance,
while function references use a `void*` instance. It is UB in C to call
the former with the latter, so clang is correct here.
We had to pick one of two ways to fix this: either emit `void*` wrapper
functions that do the appropriate downcasting for any module functions
that go into a table (potentially including imported functions), or the
approach that takes significantly less effort of changing everything to
`void*` and downcasting internally. ~~We obviously chose the latter.~~
We eventually started emitting wrapper functions.
|
|
|
|
|
|
|
|
| |
This makes `wasm_rt_init()` properly reentrant. By setting `g_alt_stack
= NULL`, we allow execution to continue beyond [wasm-rt-impl.c L171
](https://github.com/WebAssembly/wabt/blob/main/wasm2c/wasm-rt-impl.c#L171)
in `os_allocate_and_install_altstack`.
Applies to debug builds only due to `assert`.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The interpreter could overflow the stack without trapping properly in
`call_indirect` situations. While it would set the `out_trap` to the
trap reason, it would return `RunResult::Ok` and the interpreter code
would only check `RunResult::Ok` to decide whether or not to keep
running. In other words, while the stack overflow meant the interpreter
wouldn't push a frame onto the call stack, the interpreter loop would
continue advancing instructions, resulting in instructions after the
runaway `call_indirect` running.
If the offending `call_indirect` didn't have return values, it would be
as if the call returned normally. If it did have return values, nothing
would be pushed onto the value stack, yet the return types would be
pushed onto the type stack. With careful manipulation of the following
instructions, this could be used to cause all sorts of memory
corruption.
As it turns out, the function exit code, as well as a handful of other
instructions, do check the state of the value and type stacks and can
safely reproduce the bug without the memory corruption, so that's what
we made the test do.
The obvious fix was to make `call_indirect` propagate `RunResult::Trap`
properly. Additionally, we made it so `assert_exhaustion` checks both
the `RunResult` *and* the `out_trap`, and asserts if they don't match.
This should help catch similar bugs in the future.
Closes #2462
Fixes #2398
|
| |
|
| |
|
|
|
| |
Fixes #2451
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
(#2440)
|
| |
|
| |
|
| |
|