-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add proper support to C-FFI calls #2423
Comments
Hit during exploration for using https://github.com/secure-foundations/rWasm. Blocking potential customer. |
I'm getting the following failures (regressions when upgrading from 0.27.0 to 0.28.0) for 6 harnesses in a private project:
|
One C-FFI issue we run into in firecracker is with Note that here simply supporting clock_gettime as a kani-provided CMBC model wouldn't work for us, as our stub has some performance tweaks (the code-under-proof only cares about the delta between two consecutive |
That totally makes sense. We have been thinking about extending the stubbing feature to support stubs of extern functions, like C functions. I created #2587 to capture that. Thanks! |
Just added the label Happy to collaborate with anyone on a draft of the proposal. |
I'm getting this error while running kani on a single harness in my project:
|
I'm also getting the same error while trying to run a harness
|
I got this error:
But I don't understand why it says "/Users/ec2-user/". I don't have this user on my machine! :) |
Hi @swaroopmaddu, hi @ithinkicancode, for missing C functions, I would recommend you to take a look at function stubbing. We have recently added support to stubbing external functions, like C functions. @ithinkicancode I'll create a separate issue for the incorrect path that you are seeing. Thanks for bringing it up. |
I stumbled on a
I think the repeated I can't stub that directly:
It seems to be looking for I see no convenient way to figure out who the caller is, to find a higher-level function to stub. (I'm surprised the library functions I'm calling need random numbers! No idea where to start. Grep on the libraries implies it's an indirect call.) Note also that the Related
|
Hi @tv42, the error does seem incorrect, probably an issue with our resolution algorithm. The BTW, are you using any HashMap / HashSet? Are you able to post your harness? This is an example where we stub |
I discovered the library to be using HashMap, yes. This is enough to trigger the message about getrandom: #[cfg(kani)]
mod verification {
use std::collections::HashMap;
#[kani::proof]
#[kani::unwind(1)]
fn hashmap() {
let m: HashMap<String, String> = HashMap::new();
}
} It seems that part is #723. |
I believe this issue is part of adding support to C-FFI, which describes cases where an external function may call a Rust function. |
Requested feature: Add support to verifying combination of Rust and C code.
Use case: Users have C legacy code or external libraries that they would like to verify against their implementation.
It would be nice to provide out-of-box integration with C code when its source is available. Kani could compile the C code using
goto-cc
and link its generated goto-programs with Kani generated goto-program.We should probably create an RFC with a proper design as well as what will be expected user experience. What kind of features will be supported? What kind of UBs will be detected? How to properly link C + Rust?
The text was updated successfully, but these errors were encountered: