Skip to content

Should __getrandom_custom use "Rust" ABI? #345

Closed
@josephlr

Description

@josephlr

Right now, the implementation of the custom feature uses a #[no_mangle] function named __getrandom_custom with signature: extern "C" fn(*mut u8, usize) -> u32.

When implementing this feature in #109, I initially used the extern "Rust" ABI, but after some discussion, we decided to use extern "C" due to issues around the stability of the "Rust" ABI.

However, @LegionMammal978 noted in #341 (comment) that panicking across an extern "C" function is unsafe, and it's very possible that a custom implementation could panic (certainly we do nothing to prevent that).

So should we switch to using the "Rust" ABI? If so, should we continue passing a raw pointer/length pair, or pass a slice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions