-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Disallow loading code on x86_64-unknown-none
#11553
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
Disallow loading code on x86_64-unknown-none
#11553
Conversation
... And then also add an escape hatch to allow loading code. This commit is the culmination of discussion on bytecodealliance#11506 with a proposed resolution for Wasmtime. The resolution being: * Wasmtime will reject loading code on `x86_64-unknown-none` platforms by default. * A new `Config::x86_float_abi_ok` escape hatch is added to bypass this check. * Documentation/errors are updated around `x86_float_abi_ok` to document the situation. * The `min-platform` example is updated to showcase how this is valid to run in that particular embedding (aka enable more features and sufficiently detect said features). The basic tl;dr; is that we can't detect in stable Rust what float ABI is being used so therefore we pessimistically assume that `x86_64-unknown-none` is using a soft-float ABI. This is incompatible with libcalls unless they aren't actually called which is only possible when sufficiently many target features are enabled. The goal of this commit is to be a relatively low-effort way to place a roadblock in the way of "ok ABIs are weird" but at the same time enable getting around the roadblock easily. Additionally the roadblock points to documentation about itself to learn more about what's going on here. Closes bytecodealliance#11506
|
For posterity @fitzgen I tried to get |
Turns out it doesn't go through the same path as other bits
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.
Thanks for following up from our Cranelift meeting discussion! A minor documentation thought below in the example but otherwise this looks workable for us at least...
| "sse3" => Some(id.get_feature_info()?.has_sse3()), | ||
| "ssse3" => Some(id.get_feature_info()?.has_sse3()), | ||
| "sse4.1" => Some(id.get_feature_info()?.has_sse41()), | ||
| "sse4.2" => Some(id.get_feature_info()?.has_sse42()), | ||
| "fma" => Some(id.get_feature_info()?.has_fma()), |
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.
All of these features are required to bypass the libcalls or just a subset?
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.
SE4.1 is sufficient if you're not using relaxed-simd, but with relaxed-simd you'll also need FMA.
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
* Disallow loading code on `x86_64-unknown-none` ... And then also add an escape hatch to allow loading code. This commit is the culmination of discussion on bytecodealliance#11506 with a proposed resolution for Wasmtime. The resolution being: * Wasmtime will reject loading code on `x86_64-unknown-none` platforms by default. * A new `Config::x86_float_abi_ok` escape hatch is added to bypass this check. * Documentation/errors are updated around `x86_float_abi_ok` to document the situation. * The `min-platform` example is updated to showcase how this is valid to run in that particular embedding (aka enable more features and sufficiently detect said features). The basic tl;dr; is that we can't detect in stable Rust what float ABI is being used so therefore we pessimistically assume that `x86_64-unknown-none` is using a soft-float ABI. This is incompatible with libcalls unless they aren't actually called which is only possible when sufficiently many target features are enabled. The goal of this commit is to be a relatively low-effort way to place a roadblock in the way of "ok ABIs are weird" but at the same time enable getting around the roadblock easily. Additionally the roadblock points to documentation about itself to learn more about what's going on here. Closes bytecodealliance#11506 * Add audit of raw-cpuid * Add back in check Turns out it doesn't go through the same path as other bits * Review comments * Fix running floats without without custom support
... And then also add an escape hatch to allow loading code. This commit is the culmination of discussion on #11506 with a proposed resolution for Wasmtime. The resolution being:
x86_64-unknown-noneplatforms by default.Config::x86_float_abi_okescape hatch is added to bypass this check.x86_float_abi_okto document the situation.min-platformexample is updated to showcase how this is valid to run in that particular embedding (aka enable more features and sufficiently detect said features).The basic tl;dr; is that we can't detect in stable Rust what float ABI is being used so therefore we pessimistically assume that
x86_64-unknown-noneis using a soft-float ABI. This is incompatible with libcalls unless they aren't actually called which is only possible when sufficiently many target features are enabled.The goal of this commit is to be a relatively low-effort way to place a roadblock in the way of "ok ABIs are weird" but at the same time enable getting around the roadblock easily. Additionally the roadblock points to documentation about itself to learn more about what's going on here.
Closes #11506