Skip to content

Enable Miri to pass pointers through FFI - #129684

Merged
bors merged 1 commit into
rust-lang:masterfrom
Strophox:miri-pass-pointer-to-ffi
Aug 31, 2024
Merged

bors merged 1 commit into
rust-lang:masterfrom
Strophox:miri-pass-pointer-to-ffi

Conversation

@Strophox

Copy link
Copy Markdown
Contributor

Following #126787, the purpose of this PR is to now enable Miri to execute native calls that make use of pointers.

Simple example
extern "C" {
    fn ptr_printer(ptr: *mut i32);
}

fn main() {
    let ptr = &mut 42 as *mut i32;
    unsafe {
        ptr_printer(ptr);
    }
}
void ptr_printer(int *ptr) {
  printf("printing pointer dereference from C: %d\n", *ptr);
}

should now show printing pointer dereference from C: 42.

Note that this PR does not yet implement any logic involved in updating Miri's "analysis" state (byte initialization, provenance) upon such a native call.

r? @RalfJung

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants