forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EH] Fuzz throws from JS (WebAssembly#7027)
We already generated (throw ..) instructions in wasm, but it makes sense to model throws from outside as well, as they cross the module boundary. This adds a new fuzzer import to the generated modules, "throw", that just does a throw from JS etc. Also be more precise about handling fuzzing-support imports in fuzz-exec: we now check that logging functions start with "log*" and error otherwise (this check is now needed given we have "throw", which is not logging). Also fix a minor issue with name conflicts for logging functions by using getValidFunctionName for them, both for logging and for throw.
- Loading branch information
Showing
12 changed files
with
215 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited. | ||
|
||
;; RUN: wasm-opt %s -all --fuzz-exec -o /dev/null 2>&1 | filecheck %s | ||
|
||
;; Test the fuzzing-support module imports. | ||
|
||
(module | ||
(import "fuzzing-support" "log-i32" (func $log-i32 (param i32))) | ||
(import "fuzzing-support" "log-f64" (func $log-f64 (param f64))) | ||
|
||
(import "fuzzing-support" "throw" (func $throw)) | ||
|
||
;; CHECK: [fuzz-exec] calling logging | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 42] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] | ||
(func $logging (export "logging") | ||
(call $log-i32 | ||
(i32.const 42) | ||
) | ||
(call $log-f64 | ||
(f64.const 3.14159) | ||
) | ||
) | ||
|
||
;; CHECK: [fuzz-exec] calling throwing | ||
;; CHECK-NEXT: [exception thrown: __private ()] | ||
;; CHECK-NEXT: warning: no passes specified, not doing any work | ||
(func $throwing (export "throwing") | ||
(call $throw) | ||
) | ||
) | ||
;; CHECK: [fuzz-exec] calling logging | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 42] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 3.14159] | ||
|
||
;; CHECK: [fuzz-exec] calling throwing | ||
;; CHECK-NEXT: [exception thrown: __private ()] | ||
;; CHECK-NEXT: [fuzz-exec] comparing logging | ||
;; CHECK-NEXT: [fuzz-exec] comparing throwing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
Metrics | ||
total | ||
[exports] : 23 | ||
[funcs] : 34 | ||
[exports] : 50 | ||
[funcs] : 72 | ||
[globals] : 9 | ||
[imports] : 4 | ||
[memories] : 1 | ||
[memory-data] : 2 | ||
[table-data] : 6 | ||
[table-data] : 25 | ||
[tables] : 1 | ||
[tags] : 0 | ||
[total] : 4303 | ||
[vars] : 100 | ||
Binary : 355 | ||
Block : 684 | ||
Break : 149 | ||
Call : 219 | ||
[total] : 4381 | ||
[vars] : 218 | ||
Binary : 335 | ||
Block : 725 | ||
Break : 120 | ||
Call : 210 | ||
CallIndirect : 23 | ||
Const : 643 | ||
Drop : 50 | ||
GlobalGet : 367 | ||
GlobalSet : 258 | ||
If : 206 | ||
Load : 78 | ||
LocalGet : 339 | ||
LocalSet : 236 | ||
Loop : 93 | ||
Nop : 41 | ||
RefFunc : 6 | ||
Return : 45 | ||
Select : 41 | ||
Store : 36 | ||
Switch : 1 | ||
Unary : 304 | ||
Unreachable : 129 | ||
Const : 692 | ||
Drop : 64 | ||
GlobalGet : 391 | ||
GlobalSet : 298 | ||
If : 236 | ||
Load : 71 | ||
LocalGet : 285 | ||
LocalSet : 209 | ||
Loop : 76 | ||
Nop : 63 | ||
RefFunc : 25 | ||
Return : 60 | ||
Select : 23 | ||
Store : 29 | ||
Switch : 2 | ||
Unary : 293 | ||
Unreachable : 151 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.