Skip to content

Add "typechecking" to DynamicLib #17833

@kmcallister

Description

@kmcallister

We'd produce a metadata table with a TypeId hash for each exported symbol and check it in DynamicLibrary::symbol. The function will still need to be unsafe because there are plenty of ways to deliberately circumvent the check (collisions of the 64-bit hash, hex-editing the .so file, etc) but it will fix the poor user experience of accidental type mismatch when using plugins (in the case of rustc plugins, this is #14841).

We'll also have DynamicLibrary::raw_symbol which does no typecheck, gives an *mut u8, and can be used with non-Rust .so's.

I plan to work on this after #8157.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-pluginsArea: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions