-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
cranelift-icache fuzzbug: "internal error: entered unreachable code: Invalid OperandSize: 16" #4756
Comments
According to
So the x64 backend is just refusing to compile an i128 udiv. |
Yep, this is an internal panic (not even an error propagated up to callers), and I'm afraid that the icache fuzz target, as it directly generates CLIF code (as opposed to other fuzz targets which generate wasm code translated to CLIF) will keep on hitting those things that haven't been implemented because they weren't useful for wasm. (I guess that's the same situation cg_clif would be facing if it was being fuzzed.) The overall solution I can think of is to make all those |
cg_clif specifically lowers these ops directly into a libcall, so it never hits this path. But this probably could have also been reported in the fuzzgen differential fuzzer since they share pretty much the same code paths.
What first came to mind was implementing the i128 div/rem ops, but another solution is to prevent the function generator from building i128 div/rem ops. We've disabled ops in the past where the x64 backend isn't ready to deal with them yet. Although if we do disable those ops, we shouldn't commit that PR just yet, for the same reasons as #4752 (comment) It will mark all issues as fixed in OSS Fuzz and then probably create dups in the future. This would solve this immediate issue, but not the overall solution of not panicking during compilation (which I think is a great idea, but probably not for now!) |
Yes, the ideal answer here is that the verifier is the one gate that determines/defines what is valid CLIF; and if valid, then a correct backend can compile it. Anything less than that is in theory a temporary situation, a place where we either want to eventually fill out the backend or reduce the scope of valid CLIF at the verifier level (by changing the definitions in the meta crate). I don't necessarily think introducing If we don't expect to actually use |
Based on the discussion in #4771, I think it's better to keep the 128-bit versions of division operators: cg_clif needs them and is currently working around their absence by generating function calls to compiler-builtins implementations. I like Afonso's suggestion of having Cranelift implement these instructions as libcalls, although it sounds like there are some potential issues there. |
Discovered on oss-fuzz (https://oss-fuzz.com/testcase-detail/6676165556830208)
base64 -d
to decode input:cc @bnjbvr
The text was updated successfully, but these errors were encountered: