Skip to content

Why is origin relocation so unsafe? #26

@morr0ne

Description

@morr0ne

Following up on #23, it's still not clear to me exactly why relocation is so hard to implement safely. When building a normal rust binary linking to libc I never had to worry about such problems. The conclusion to draw here is obviously that libc is doing some magic behind the scene to relocate when necessary, unless that is itself has questionable safety? Does rust just assume that libc implementation is good enough? Does the relocation come from somewhere else? Couldn't origin "port" an existing proven implementation? And even then how much of that is the job of the compiler vs the dynamic linker vs libc/crt0? Perhaps I'm asking to many question but I'd love to get a better understanding on what's happening on the lower level and the safety implications of that. Is it even possible to make such code safe? Is rust just blindly trusting that the code it's linking is safe? Maybe such question are much bigger that origin itself but I can't really think of another case like this one for something as modern as rust. I am not sure if questions like this should be asked somewhere else but searching elsewhere always leads to ancient C code (or at least compared to rust) that essentially doesn't worry about any safety and just trusts the compiler and standard library implementations.

On a final note, this is probably way to long of an issue and it doesn't even feel as such. I think this would be a better fit for github discussions or perhaps some other place like matrix or discord to allow for easier discussions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions