-
Notifications
You must be signed in to change notification settings - Fork 109
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
Global ASM is not supported #316
Labels
[C] Feature / Enhancement
A new feature request or enhancement to an existing feature.
[E] Unsupported Construct
Add support to an unsupported construct
Milestone
Comments
The "Raise a warning" item can be marked as done, right? |
Capturing the current behavior as of c3d41b9: Kani produces a codegen warning, but does not cause verification to fail. For example, on the following test (adapted from the one here): pub mod sally {
std::arch::global_asm!(
".global foo",
"foo:",
"jmp baz",
);
#[no_mangle]
pub unsafe extern "C" fn baz() {}
}
// the symbols `foo` and `bar` are global, no matter where
// `global_asm!` was used.
extern "C" {
fn foo();
fn bar();
}
pub mod harry {
std::arch::global_asm!(
".global bar",
"bar:",
"jmp quux",
);
#[no_mangle]
pub unsafe extern "C" fn quux() {}
}
#[kani::proof]
fn main() {
assert!(1 + 1 == 2);
} Kani produces two codegen warnings:
but verification passes:
|
4 tasks
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[C] Feature / Enhancement
A new feature request or enhancement to an existing feature.
[E] Unsupported Construct
Add support to an unsupported construct
Following LLVM, Rust allows global ASM in a module. This means that crates can have arbitrary code that we cannot analyze.
Likelihood
We know of crates that use this feature
Mitigation
We could fail any crate that uses this feature, but this would block any use of those crates, even if they did not use any of the risky features. Even worse, this would block all consumers of such crates, from even compiling, again even if they do not use any of the dangerous features.
Unlike for inline ASM in a function, where we can insert
assert(0)
as a mechanism to guarantee soundness, there is no obvious way to only fail code paths that use the injected ASM.Path to soundness
Documentation
https://rust-lang.github.io/rfcs/1548-global-asm.html
The text was updated successfully, but these errors were encountered: