-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EH] Fuzzer: Add WebAssembly.JSTag fuzzing #7283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have tests that actually use the JSTag
?
Yes, once we import it into wasm, it is just another in the list of tags, which means it will get catches, throws, etc. |
The fuzzer just found a bug here in fact, I pushed a fix. I forgot to use the imported tag in execution-results, so the binaryen interpreter was not catching JS exceptions when it used that tag (which differs from v8, so the fuzzer errored). |
src/tools/execution-results.h
Outdated
@@ -173,8 +181,11 @@ struct LoggingExternalInterface : public ShellExternalInterface { | |||
} | |||
|
|||
void throwEmptyException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention of this method is to throw a JS exception, how about naming it throwJSException
or something to be clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done.
The fuzzer noticed that duplicate tags can cause issues due to the interpreter using tag names, see I pushed a workaround. |
…#7286) We do not compare exceptions in binaryen (not in the optimizer, where we assume we can reorder traps, and not in the fuzzer, where we assume VMs may have different text for them). But, since we have try-catch in wasm, we can actually end up comparing them, by catching the exception and logging the output. For that reason, we need to throw exactly the same JS exception in #7283, which this fixes.
This JS API represents the tag of JS exceptions. Import it into the wasm
so that wasm can catch and throw JS exceptions.
Rename the previous "jsTag", which means "wasm tag created in JS" to
"wasmTag" to avoid confusion.