Skip to content

Shims should check ABI #1631

Closed
Closed
@RalfJung

Description

@RalfJung

Our shims for missing extern functions now all check that the right number of arguments is being passed. However, they should also check that the right ABI is used.

To do this, probably first librustc_mir needs to be changed to even propagate this information to Miri's find_mir_or_eval_fn.

The goal is to reject buggy code like this:

fn main() {
    extern "Rust" { // should be "C"!
        fn malloc(size: usize) -> *mut std::ffi::c_void;
    }

    unsafe {
        let _ = malloc(0);
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementE-good-first-issueA good way to start contributing, mentoring is available

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions